// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![allow(rustdoc::invalid_html_tags)]

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::DataFoundryService;
/// let client = DataFoundryService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for generating and preparing datasets for Gen AI evaluation.
///
/// # Configuration
///
/// To configure `DataFoundryService` use the `with_*` methods in the type returned
/// by [builder()][DataFoundryService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::data_foundry_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::data_foundry_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `DataFoundryService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `DataFoundryService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "data-foundry-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "data-foundry-service")))]
#[derive(Clone, Debug)]
pub struct DataFoundryService {
    inner: std::sync::Arc<dyn super::stub::dynamic::DataFoundryService>,
}

#[cfg(feature = "data-foundry-service")]
impl DataFoundryService {
    /// Returns a builder for [DataFoundryService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::DataFoundryService;
    /// let client = DataFoundryService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::data_foundry_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::data_foundry_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::DataFoundryService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::DataFoundryService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::DataFoundryService> {
        super::transport::DataFoundryService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::DataFoundryService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::DataFoundryService::new)
    }

    /// Generates synthetic data based on the provided configuration.
    pub fn generate_synthetic_data(
        &self,
    ) -> super::builder::data_foundry_service::GenerateSyntheticData {
        super::builder::data_foundry_service::GenerateSyntheticData::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::data_foundry_service::ListLocations {
        super::builder::data_foundry_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::data_foundry_service::GetLocation {
        super::builder::data_foundry_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::data_foundry_service::SetIamPolicy {
        super::builder::data_foundry_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::data_foundry_service::GetIamPolicy {
        super::builder::data_foundry_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::data_foundry_service::TestIamPermissions {
        super::builder::data_foundry_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::data_foundry_service::ListOperations {
        super::builder::data_foundry_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::data_foundry_service::GetOperation {
        super::builder::data_foundry_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::data_foundry_service::DeleteOperation {
        super::builder::data_foundry_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::data_foundry_service::CancelOperation {
        super::builder::data_foundry_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::data_foundry_service::WaitOperation {
        super::builder::data_foundry_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::DatasetService;
/// let client = DatasetService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// The service that manages Vertex AI Dataset and its child resources.
///
/// # Configuration
///
/// To configure `DatasetService` use the `with_*` methods in the type returned
/// by [builder()][DatasetService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::dataset_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::dataset_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `DatasetService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `DatasetService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "dataset-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "dataset-service")))]
#[derive(Clone, Debug)]
pub struct DatasetService {
    inner: std::sync::Arc<dyn super::stub::dynamic::DatasetService>,
}

#[cfg(feature = "dataset-service")]
impl DatasetService {
    /// Returns a builder for [DatasetService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::DatasetService;
    /// let client = DatasetService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::dataset_service::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::dataset_service::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::DatasetService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::DatasetService>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::DatasetService> {
        super::transport::DatasetService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::DatasetService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::DatasetService::new)
    }

    /// Creates a Dataset.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_dataset(&self) -> super::builder::dataset_service::CreateDataset {
        super::builder::dataset_service::CreateDataset::new(self.inner.clone())
    }

    /// Gets a Dataset.
    pub fn get_dataset(&self) -> super::builder::dataset_service::GetDataset {
        super::builder::dataset_service::GetDataset::new(self.inner.clone())
    }

    /// Updates a Dataset.
    pub fn update_dataset(&self) -> super::builder::dataset_service::UpdateDataset {
        super::builder::dataset_service::UpdateDataset::new(self.inner.clone())
    }

    /// Lists Datasets in a Location.
    pub fn list_datasets(&self) -> super::builder::dataset_service::ListDatasets {
        super::builder::dataset_service::ListDatasets::new(self.inner.clone())
    }

    /// Deletes a Dataset.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_dataset(&self) -> super::builder::dataset_service::DeleteDataset {
        super::builder::dataset_service::DeleteDataset::new(self.inner.clone())
    }

    /// Imports data into a Dataset.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn import_data(&self) -> super::builder::dataset_service::ImportData {
        super::builder::dataset_service::ImportData::new(self.inner.clone())
    }

    /// Exports data from a Dataset.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn export_data(&self) -> super::builder::dataset_service::ExportData {
        super::builder::dataset_service::ExportData::new(self.inner.clone())
    }

    /// Create a version from a Dataset.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_dataset_version(&self) -> super::builder::dataset_service::CreateDatasetVersion {
        super::builder::dataset_service::CreateDatasetVersion::new(self.inner.clone())
    }

    /// Updates a DatasetVersion.
    pub fn update_dataset_version(&self) -> super::builder::dataset_service::UpdateDatasetVersion {
        super::builder::dataset_service::UpdateDatasetVersion::new(self.inner.clone())
    }

    /// Deletes a Dataset version.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_dataset_version(&self) -> super::builder::dataset_service::DeleteDatasetVersion {
        super::builder::dataset_service::DeleteDatasetVersion::new(self.inner.clone())
    }

    /// Gets a Dataset version.
    pub fn get_dataset_version(&self) -> super::builder::dataset_service::GetDatasetVersion {
        super::builder::dataset_service::GetDatasetVersion::new(self.inner.clone())
    }

    /// Lists DatasetVersions in a Dataset.
    pub fn list_dataset_versions(&self) -> super::builder::dataset_service::ListDatasetVersions {
        super::builder::dataset_service::ListDatasetVersions::new(self.inner.clone())
    }

    /// Restores a dataset version.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn restore_dataset_version(
        &self,
    ) -> super::builder::dataset_service::RestoreDatasetVersion {
        super::builder::dataset_service::RestoreDatasetVersion::new(self.inner.clone())
    }

    /// Lists DataItems in a Dataset.
    pub fn list_data_items(&self) -> super::builder::dataset_service::ListDataItems {
        super::builder::dataset_service::ListDataItems::new(self.inner.clone())
    }

    /// Searches DataItems in a Dataset.
    pub fn search_data_items(&self) -> super::builder::dataset_service::SearchDataItems {
        super::builder::dataset_service::SearchDataItems::new(self.inner.clone())
    }

    /// Lists SavedQueries in a Dataset.
    pub fn list_saved_queries(&self) -> super::builder::dataset_service::ListSavedQueries {
        super::builder::dataset_service::ListSavedQueries::new(self.inner.clone())
    }

    /// Deletes a SavedQuery.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_saved_query(&self) -> super::builder::dataset_service::DeleteSavedQuery {
        super::builder::dataset_service::DeleteSavedQuery::new(self.inner.clone())
    }

    /// Gets an AnnotationSpec.
    pub fn get_annotation_spec(&self) -> super::builder::dataset_service::GetAnnotationSpec {
        super::builder::dataset_service::GetAnnotationSpec::new(self.inner.clone())
    }

    /// Lists Annotations belongs to a dataitem
    /// This RPC is only available in InternalDatasetService. It is only used for
    /// exporting conversation data to CCAI Insights.
    pub fn list_annotations(&self) -> super::builder::dataset_service::ListAnnotations {
        super::builder::dataset_service::ListAnnotations::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::dataset_service::ListLocations {
        super::builder::dataset_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::dataset_service::GetLocation {
        super::builder::dataset_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::dataset_service::SetIamPolicy {
        super::builder::dataset_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::dataset_service::GetIamPolicy {
        super::builder::dataset_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::dataset_service::TestIamPermissions {
        super::builder::dataset_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::dataset_service::ListOperations {
        super::builder::dataset_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::dataset_service::GetOperation {
        super::builder::dataset_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::dataset_service::DeleteOperation {
        super::builder::dataset_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::dataset_service::CancelOperation {
        super::builder::dataset_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::dataset_service::WaitOperation {
        super::builder::dataset_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
/// let client = DeploymentResourcePoolService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service that manages the DeploymentResourcePool resource.
///
/// # Configuration
///
/// To configure `DeploymentResourcePoolService` use the `with_*` methods in the type returned
/// by [builder()][DeploymentResourcePoolService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::deployment_resource_pool_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::deployment_resource_pool_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `DeploymentResourcePoolService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `DeploymentResourcePoolService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "deployment-resource-pool-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "deployment-resource-pool-service")))]
#[derive(Clone, Debug)]
pub struct DeploymentResourcePoolService {
    inner: std::sync::Arc<dyn super::stub::dynamic::DeploymentResourcePoolService>,
}

#[cfg(feature = "deployment-resource-pool-service")]
impl DeploymentResourcePoolService {
    /// Returns a builder for [DeploymentResourcePoolService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::DeploymentResourcePoolService;
    /// let client = DeploymentResourcePoolService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::deployment_resource_pool_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::deployment_resource_pool_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::DeploymentResourcePoolService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<
        std::sync::Arc<dyn super::stub::dynamic::DeploymentResourcePoolService>,
    > {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::DeploymentResourcePoolService> {
        super::transport::DeploymentResourcePoolService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::DeploymentResourcePoolService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::DeploymentResourcePoolService::new)
    }

    /// Create a DeploymentResourcePool.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_deployment_resource_pool(
        &self,
    ) -> super::builder::deployment_resource_pool_service::CreateDeploymentResourcePool {
        super::builder::deployment_resource_pool_service::CreateDeploymentResourcePool::new(
            self.inner.clone(),
        )
    }

    /// Get a DeploymentResourcePool.
    pub fn get_deployment_resource_pool(
        &self,
    ) -> super::builder::deployment_resource_pool_service::GetDeploymentResourcePool {
        super::builder::deployment_resource_pool_service::GetDeploymentResourcePool::new(
            self.inner.clone(),
        )
    }

    /// List DeploymentResourcePools in a location.
    pub fn list_deployment_resource_pools(
        &self,
    ) -> super::builder::deployment_resource_pool_service::ListDeploymentResourcePools {
        super::builder::deployment_resource_pool_service::ListDeploymentResourcePools::new(
            self.inner.clone(),
        )
    }

    /// Update a DeploymentResourcePool.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_deployment_resource_pool(
        &self,
    ) -> super::builder::deployment_resource_pool_service::UpdateDeploymentResourcePool {
        super::builder::deployment_resource_pool_service::UpdateDeploymentResourcePool::new(
            self.inner.clone(),
        )
    }

    /// Delete a DeploymentResourcePool.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_deployment_resource_pool(
        &self,
    ) -> super::builder::deployment_resource_pool_service::DeleteDeploymentResourcePool {
        super::builder::deployment_resource_pool_service::DeleteDeploymentResourcePool::new(
            self.inner.clone(),
        )
    }

    /// List DeployedModels that have been deployed on this DeploymentResourcePool.
    pub fn query_deployed_models(
        &self,
    ) -> super::builder::deployment_resource_pool_service::QueryDeployedModels {
        super::builder::deployment_resource_pool_service::QueryDeployedModels::new(
            self.inner.clone(),
        )
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(
        &self,
    ) -> super::builder::deployment_resource_pool_service::ListLocations {
        super::builder::deployment_resource_pool_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::deployment_resource_pool_service::GetLocation {
        super::builder::deployment_resource_pool_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::deployment_resource_pool_service::SetIamPolicy {
        super::builder::deployment_resource_pool_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::deployment_resource_pool_service::GetIamPolicy {
        super::builder::deployment_resource_pool_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::deployment_resource_pool_service::TestIamPermissions {
        super::builder::deployment_resource_pool_service::TestIamPermissions::new(
            self.inner.clone(),
        )
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(
        &self,
    ) -> super::builder::deployment_resource_pool_service::ListOperations {
        super::builder::deployment_resource_pool_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::deployment_resource_pool_service::GetOperation {
        super::builder::deployment_resource_pool_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(
        &self,
    ) -> super::builder::deployment_resource_pool_service::DeleteOperation {
        super::builder::deployment_resource_pool_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(
        &self,
    ) -> super::builder::deployment_resource_pool_service::CancelOperation {
        super::builder::deployment_resource_pool_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(
        &self,
    ) -> super::builder::deployment_resource_pool_service::WaitOperation {
        super::builder::deployment_resource_pool_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::EndpointService;
/// let client = EndpointService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for managing Vertex AI's Endpoints.
///
/// # Configuration
///
/// To configure `EndpointService` use the `with_*` methods in the type returned
/// by [builder()][EndpointService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::endpoint_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::endpoint_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `EndpointService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `EndpointService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "endpoint-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "endpoint-service")))]
#[derive(Clone, Debug)]
pub struct EndpointService {
    inner: std::sync::Arc<dyn super::stub::dynamic::EndpointService>,
}

#[cfg(feature = "endpoint-service")]
impl EndpointService {
    /// Returns a builder for [EndpointService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::EndpointService;
    /// let client = EndpointService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::endpoint_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::endpoint_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::EndpointService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::EndpointService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::EndpointService> {
        super::transport::EndpointService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::EndpointService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::EndpointService::new)
    }

    /// Creates an Endpoint.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_endpoint(&self) -> super::builder::endpoint_service::CreateEndpoint {
        super::builder::endpoint_service::CreateEndpoint::new(self.inner.clone())
    }

    /// Gets an Endpoint.
    pub fn get_endpoint(&self) -> super::builder::endpoint_service::GetEndpoint {
        super::builder::endpoint_service::GetEndpoint::new(self.inner.clone())
    }

    /// Lists Endpoints in a Location.
    pub fn list_endpoints(&self) -> super::builder::endpoint_service::ListEndpoints {
        super::builder::endpoint_service::ListEndpoints::new(self.inner.clone())
    }

    /// Updates an Endpoint.
    pub fn update_endpoint(&self) -> super::builder::endpoint_service::UpdateEndpoint {
        super::builder::endpoint_service::UpdateEndpoint::new(self.inner.clone())
    }

    /// Updates an Endpoint with a long running operation.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_endpoint_long_running(
        &self,
    ) -> super::builder::endpoint_service::UpdateEndpointLongRunning {
        super::builder::endpoint_service::UpdateEndpointLongRunning::new(self.inner.clone())
    }

    /// Deletes an Endpoint.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_endpoint(&self) -> super::builder::endpoint_service::DeleteEndpoint {
        super::builder::endpoint_service::DeleteEndpoint::new(self.inner.clone())
    }

    /// Deploys a Model into this Endpoint, creating a DeployedModel within it.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn deploy_model(&self) -> super::builder::endpoint_service::DeployModel {
        super::builder::endpoint_service::DeployModel::new(self.inner.clone())
    }

    /// Undeploys a Model from an Endpoint, removing a DeployedModel from it, and
    /// freeing all resources it's using.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn undeploy_model(&self) -> super::builder::endpoint_service::UndeployModel {
        super::builder::endpoint_service::UndeployModel::new(self.inner.clone())
    }

    /// Updates an existing deployed model. Updatable fields include
    /// `min_replica_count`, `max_replica_count`, `required_replica_count`,
    /// `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and
    /// `enable_container_logging` (v1beta1 only).
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn mutate_deployed_model(&self) -> super::builder::endpoint_service::MutateDeployedModel {
        super::builder::endpoint_service::MutateDeployedModel::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::endpoint_service::ListLocations {
        super::builder::endpoint_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::endpoint_service::GetLocation {
        super::builder::endpoint_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::endpoint_service::SetIamPolicy {
        super::builder::endpoint_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::endpoint_service::GetIamPolicy {
        super::builder::endpoint_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::endpoint_service::TestIamPermissions {
        super::builder::endpoint_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::endpoint_service::ListOperations {
        super::builder::endpoint_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::endpoint_service::GetOperation {
        super::builder::endpoint_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::endpoint_service::DeleteOperation {
        super::builder::endpoint_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::endpoint_service::CancelOperation {
        super::builder::endpoint_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::endpoint_service::WaitOperation {
        super::builder::endpoint_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::EvaluationService;
/// let client = EvaluationService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Vertex AI Online Evaluation Service.
///
/// # Configuration
///
/// To configure `EvaluationService` use the `with_*` methods in the type returned
/// by [builder()][EvaluationService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::evaluation_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::evaluation_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `EvaluationService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `EvaluationService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "evaluation-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "evaluation-service")))]
#[derive(Clone, Debug)]
pub struct EvaluationService {
    inner: std::sync::Arc<dyn super::stub::dynamic::EvaluationService>,
}

#[cfg(feature = "evaluation-service")]
impl EvaluationService {
    /// Returns a builder for [EvaluationService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::EvaluationService;
    /// let client = EvaluationService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::evaluation_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::evaluation_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::EvaluationService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::EvaluationService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::EvaluationService> {
        super::transport::EvaluationService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::EvaluationService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::EvaluationService::new)
    }

    /// Evaluates instances based on a given metric.
    pub fn evaluate_instances(&self) -> super::builder::evaluation_service::EvaluateInstances {
        super::builder::evaluation_service::EvaluateInstances::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::evaluation_service::ListLocations {
        super::builder::evaluation_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::evaluation_service::GetLocation {
        super::builder::evaluation_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::evaluation_service::SetIamPolicy {
        super::builder::evaluation_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::evaluation_service::GetIamPolicy {
        super::builder::evaluation_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::evaluation_service::TestIamPermissions {
        super::builder::evaluation_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::evaluation_service::ListOperations {
        super::builder::evaluation_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::evaluation_service::GetOperation {
        super::builder::evaluation_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::evaluation_service::DeleteOperation {
        super::builder::evaluation_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::evaluation_service::CancelOperation {
        super::builder::evaluation_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::evaluation_service::WaitOperation {
        super::builder::evaluation_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
/// let client = FeatureOnlineStoreAdminService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// The service that handles CRUD and List for resources for
/// FeatureOnlineStore.
///
/// # Configuration
///
/// To configure `FeatureOnlineStoreAdminService` use the `with_*` methods in the type returned
/// by [builder()][FeatureOnlineStoreAdminService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::feature_online_store_admin_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::feature_online_store_admin_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `FeatureOnlineStoreAdminService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `FeatureOnlineStoreAdminService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "feature-online-store-admin-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "feature-online-store-admin-service")))]
#[derive(Clone, Debug)]
pub struct FeatureOnlineStoreAdminService {
    inner: std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreAdminService>,
}

#[cfg(feature = "feature-online-store-admin-service")]
impl FeatureOnlineStoreAdminService {
    /// Returns a builder for [FeatureOnlineStoreAdminService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService;
    /// let client = FeatureOnlineStoreAdminService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::feature_online_store_admin_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::feature_online_store_admin_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::FeatureOnlineStoreAdminService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<
        std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreAdminService>,
    > {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::FeatureOnlineStoreAdminService> {
        super::transport::FeatureOnlineStoreAdminService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::FeatureOnlineStoreAdminService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::FeatureOnlineStoreAdminService::new)
    }

    /// Creates a new FeatureOnlineStore in a given project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_feature_online_store(
        &self,
    ) -> super::builder::feature_online_store_admin_service::CreateFeatureOnlineStore {
        super::builder::feature_online_store_admin_service::CreateFeatureOnlineStore::new(
            self.inner.clone(),
        )
    }

    /// Gets details of a single FeatureOnlineStore.
    pub fn get_feature_online_store(
        &self,
    ) -> super::builder::feature_online_store_admin_service::GetFeatureOnlineStore {
        super::builder::feature_online_store_admin_service::GetFeatureOnlineStore::new(
            self.inner.clone(),
        )
    }

    /// Lists FeatureOnlineStores in a given project and location.
    pub fn list_feature_online_stores(
        &self,
    ) -> super::builder::feature_online_store_admin_service::ListFeatureOnlineStores {
        super::builder::feature_online_store_admin_service::ListFeatureOnlineStores::new(
            self.inner.clone(),
        )
    }

    /// Updates the parameters of a single FeatureOnlineStore.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_feature_online_store(
        &self,
    ) -> super::builder::feature_online_store_admin_service::UpdateFeatureOnlineStore {
        super::builder::feature_online_store_admin_service::UpdateFeatureOnlineStore::new(
            self.inner.clone(),
        )
    }

    /// Deletes a single FeatureOnlineStore. The FeatureOnlineStore must not
    /// contain any FeatureViews.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_feature_online_store(
        &self,
    ) -> super::builder::feature_online_store_admin_service::DeleteFeatureOnlineStore {
        super::builder::feature_online_store_admin_service::DeleteFeatureOnlineStore::new(
            self.inner.clone(),
        )
    }

    /// Creates a new FeatureView in a given FeatureOnlineStore.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_feature_view(
        &self,
    ) -> super::builder::feature_online_store_admin_service::CreateFeatureView {
        super::builder::feature_online_store_admin_service::CreateFeatureView::new(
            self.inner.clone(),
        )
    }

    /// Gets details of a single FeatureView.
    pub fn get_feature_view(
        &self,
    ) -> super::builder::feature_online_store_admin_service::GetFeatureView {
        super::builder::feature_online_store_admin_service::GetFeatureView::new(self.inner.clone())
    }

    /// Lists FeatureViews in a given FeatureOnlineStore.
    pub fn list_feature_views(
        &self,
    ) -> super::builder::feature_online_store_admin_service::ListFeatureViews {
        super::builder::feature_online_store_admin_service::ListFeatureViews::new(
            self.inner.clone(),
        )
    }

    /// Updates the parameters of a single FeatureView.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_feature_view(
        &self,
    ) -> super::builder::feature_online_store_admin_service::UpdateFeatureView {
        super::builder::feature_online_store_admin_service::UpdateFeatureView::new(
            self.inner.clone(),
        )
    }

    /// Deletes a single FeatureView.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_feature_view(
        &self,
    ) -> super::builder::feature_online_store_admin_service::DeleteFeatureView {
        super::builder::feature_online_store_admin_service::DeleteFeatureView::new(
            self.inner.clone(),
        )
    }

    /// Triggers on-demand sync for the FeatureView.
    pub fn sync_feature_view(
        &self,
    ) -> super::builder::feature_online_store_admin_service::SyncFeatureView {
        super::builder::feature_online_store_admin_service::SyncFeatureView::new(self.inner.clone())
    }

    /// Gets details of a single FeatureViewSync.
    pub fn get_feature_view_sync(
        &self,
    ) -> super::builder::feature_online_store_admin_service::GetFeatureViewSync {
        super::builder::feature_online_store_admin_service::GetFeatureViewSync::new(
            self.inner.clone(),
        )
    }

    /// Lists FeatureViewSyncs in a given FeatureView.
    pub fn list_feature_view_syncs(
        &self,
    ) -> super::builder::feature_online_store_admin_service::ListFeatureViewSyncs {
        super::builder::feature_online_store_admin_service::ListFeatureViewSyncs::new(
            self.inner.clone(),
        )
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(
        &self,
    ) -> super::builder::feature_online_store_admin_service::ListLocations {
        super::builder::feature_online_store_admin_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::feature_online_store_admin_service::GetLocation {
        super::builder::feature_online_store_admin_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(
        &self,
    ) -> super::builder::feature_online_store_admin_service::SetIamPolicy {
        super::builder::feature_online_store_admin_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(
        &self,
    ) -> super::builder::feature_online_store_admin_service::GetIamPolicy {
        super::builder::feature_online_store_admin_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::feature_online_store_admin_service::TestIamPermissions {
        super::builder::feature_online_store_admin_service::TestIamPermissions::new(
            self.inner.clone(),
        )
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(
        &self,
    ) -> super::builder::feature_online_store_admin_service::ListOperations {
        super::builder::feature_online_store_admin_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(
        &self,
    ) -> super::builder::feature_online_store_admin_service::GetOperation {
        super::builder::feature_online_store_admin_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(
        &self,
    ) -> super::builder::feature_online_store_admin_service::DeleteOperation {
        super::builder::feature_online_store_admin_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(
        &self,
    ) -> super::builder::feature_online_store_admin_service::CancelOperation {
        super::builder::feature_online_store_admin_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(
        &self,
    ) -> super::builder::feature_online_store_admin_service::WaitOperation {
        super::builder::feature_online_store_admin_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
/// let client = FeatureOnlineStoreService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for fetching feature values from the online store.
///
/// # Configuration
///
/// To configure `FeatureOnlineStoreService` use the `with_*` methods in the type returned
/// by [builder()][FeatureOnlineStoreService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::feature_online_store_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::feature_online_store_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `FeatureOnlineStoreService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `FeatureOnlineStoreService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "feature-online-store-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "feature-online-store-service")))]
#[derive(Clone, Debug)]
pub struct FeatureOnlineStoreService {
    inner: std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreService>,
}

#[cfg(feature = "feature-online-store-service")]
impl FeatureOnlineStoreService {
    /// Returns a builder for [FeatureOnlineStoreService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::FeatureOnlineStoreService;
    /// let client = FeatureOnlineStoreService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::feature_online_store_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::feature_online_store_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::FeatureOnlineStoreService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<
        std::sync::Arc<dyn super::stub::dynamic::FeatureOnlineStoreService>,
    > {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::FeatureOnlineStoreService> {
        super::transport::FeatureOnlineStoreService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::FeatureOnlineStoreService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::FeatureOnlineStoreService::new)
    }

    /// Fetch feature values under a FeatureView.
    pub fn fetch_feature_values(
        &self,
    ) -> super::builder::feature_online_store_service::FetchFeatureValues {
        super::builder::feature_online_store_service::FetchFeatureValues::new(self.inner.clone())
    }

    /// Search the nearest entities under a FeatureView.
    /// Search only works for indexable feature view; if a feature view isn't
    /// indexable, returns Invalid argument response.
    pub fn search_nearest_entities(
        &self,
    ) -> super::builder::feature_online_store_service::SearchNearestEntities {
        super::builder::feature_online_store_service::SearchNearestEntities::new(self.inner.clone())
    }

    /// RPC to generate an access token for the given feature view. FeatureViews
    /// under the same FeatureOnlineStore share the same access token.
    pub fn generate_fetch_access_token(
        &self,
    ) -> super::builder::feature_online_store_service::GenerateFetchAccessToken {
        super::builder::feature_online_store_service::GenerateFetchAccessToken::new(
            self.inner.clone(),
        )
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::feature_online_store_service::ListLocations {
        super::builder::feature_online_store_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::feature_online_store_service::GetLocation {
        super::builder::feature_online_store_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::feature_online_store_service::SetIamPolicy {
        super::builder::feature_online_store_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::feature_online_store_service::GetIamPolicy {
        super::builder::feature_online_store_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::feature_online_store_service::TestIamPermissions {
        super::builder::feature_online_store_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::feature_online_store_service::ListOperations {
        super::builder::feature_online_store_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::feature_online_store_service::GetOperation {
        super::builder::feature_online_store_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(
        &self,
    ) -> super::builder::feature_online_store_service::DeleteOperation {
        super::builder::feature_online_store_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(
        &self,
    ) -> super::builder::feature_online_store_service::CancelOperation {
        super::builder::feature_online_store_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::feature_online_store_service::WaitOperation {
        super::builder::feature_online_store_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
/// let client = FeatureRegistryService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// The service that handles CRUD and List for resources for
/// FeatureRegistry.
///
/// # Configuration
///
/// To configure `FeatureRegistryService` use the `with_*` methods in the type returned
/// by [builder()][FeatureRegistryService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::feature_registry_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::feature_registry_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `FeatureRegistryService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `FeatureRegistryService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "feature-registry-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "feature-registry-service")))]
#[derive(Clone, Debug)]
pub struct FeatureRegistryService {
    inner: std::sync::Arc<dyn super::stub::dynamic::FeatureRegistryService>,
}

#[cfg(feature = "feature-registry-service")]
impl FeatureRegistryService {
    /// Returns a builder for [FeatureRegistryService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::FeatureRegistryService;
    /// let client = FeatureRegistryService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::feature_registry_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::feature_registry_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::FeatureRegistryService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::FeatureRegistryService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::FeatureRegistryService> {
        super::transport::FeatureRegistryService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::FeatureRegistryService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::FeatureRegistryService::new)
    }

    /// Creates a new FeatureGroup in a given project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_feature_group(
        &self,
    ) -> super::builder::feature_registry_service::CreateFeatureGroup {
        super::builder::feature_registry_service::CreateFeatureGroup::new(self.inner.clone())
    }

    /// Gets details of a single FeatureGroup.
    pub fn get_feature_group(&self) -> super::builder::feature_registry_service::GetFeatureGroup {
        super::builder::feature_registry_service::GetFeatureGroup::new(self.inner.clone())
    }

    /// Lists FeatureGroups in a given project and location.
    pub fn list_feature_groups(
        &self,
    ) -> super::builder::feature_registry_service::ListFeatureGroups {
        super::builder::feature_registry_service::ListFeatureGroups::new(self.inner.clone())
    }

    /// Updates the parameters of a single FeatureGroup.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_feature_group(
        &self,
    ) -> super::builder::feature_registry_service::UpdateFeatureGroup {
        super::builder::feature_registry_service::UpdateFeatureGroup::new(self.inner.clone())
    }

    /// Deletes a single FeatureGroup.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_feature_group(
        &self,
    ) -> super::builder::feature_registry_service::DeleteFeatureGroup {
        super::builder::feature_registry_service::DeleteFeatureGroup::new(self.inner.clone())
    }

    /// Creates a new Feature in a given FeatureGroup.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_feature(&self) -> super::builder::feature_registry_service::CreateFeature {
        super::builder::feature_registry_service::CreateFeature::new(self.inner.clone())
    }

    /// Creates a batch of Features in a given FeatureGroup.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_create_features(
        &self,
    ) -> super::builder::feature_registry_service::BatchCreateFeatures {
        super::builder::feature_registry_service::BatchCreateFeatures::new(self.inner.clone())
    }

    /// Gets details of a single Feature.
    pub fn get_feature(&self) -> super::builder::feature_registry_service::GetFeature {
        super::builder::feature_registry_service::GetFeature::new(self.inner.clone())
    }

    /// Lists Features in a given FeatureGroup.
    pub fn list_features(&self) -> super::builder::feature_registry_service::ListFeatures {
        super::builder::feature_registry_service::ListFeatures::new(self.inner.clone())
    }

    /// Updates the parameters of a single Feature.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_feature(&self) -> super::builder::feature_registry_service::UpdateFeature {
        super::builder::feature_registry_service::UpdateFeature::new(self.inner.clone())
    }

    /// Deletes a single Feature.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_feature(&self) -> super::builder::feature_registry_service::DeleteFeature {
        super::builder::feature_registry_service::DeleteFeature::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::feature_registry_service::ListLocations {
        super::builder::feature_registry_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::feature_registry_service::GetLocation {
        super::builder::feature_registry_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::feature_registry_service::SetIamPolicy {
        super::builder::feature_registry_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::feature_registry_service::GetIamPolicy {
        super::builder::feature_registry_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::feature_registry_service::TestIamPermissions {
        super::builder::feature_registry_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::feature_registry_service::ListOperations {
        super::builder::feature_registry_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::feature_registry_service::GetOperation {
        super::builder::feature_registry_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::feature_registry_service::DeleteOperation {
        super::builder::feature_registry_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::feature_registry_service::CancelOperation {
        super::builder::feature_registry_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::feature_registry_service::WaitOperation {
        super::builder::feature_registry_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
/// let client = FeaturestoreOnlineServingService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for serving online feature values.
///
/// # Configuration
///
/// To configure `FeaturestoreOnlineServingService` use the `with_*` methods in the type returned
/// by [builder()][FeaturestoreOnlineServingService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::featurestore_online_serving_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::featurestore_online_serving_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `FeaturestoreOnlineServingService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `FeaturestoreOnlineServingService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "featurestore-online-serving-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-online-serving-service")))]
#[derive(Clone, Debug)]
pub struct FeaturestoreOnlineServingService {
    inner: std::sync::Arc<dyn super::stub::dynamic::FeaturestoreOnlineServingService>,
}

#[cfg(feature = "featurestore-online-serving-service")]
impl FeaturestoreOnlineServingService {
    /// Returns a builder for [FeaturestoreOnlineServingService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::FeaturestoreOnlineServingService;
    /// let client = FeaturestoreOnlineServingService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::featurestore_online_serving_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::featurestore_online_serving_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::FeaturestoreOnlineServingService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<
        std::sync::Arc<dyn super::stub::dynamic::FeaturestoreOnlineServingService>,
    > {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::FeaturestoreOnlineServingService> {
        super::transport::FeaturestoreOnlineServingService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::FeaturestoreOnlineServingService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::FeaturestoreOnlineServingService::new)
    }

    /// Reads Feature values of a specific entity of an EntityType. For reading
    /// feature values of multiple entities of an EntityType, please use
    /// StreamingReadFeatureValues.
    pub fn read_feature_values(
        &self,
    ) -> super::builder::featurestore_online_serving_service::ReadFeatureValues {
        super::builder::featurestore_online_serving_service::ReadFeatureValues::new(
            self.inner.clone(),
        )
    }

    /// Writes Feature values of one or more entities of an EntityType.
    ///
    /// The Feature values are merged into existing entities if any. The Feature
    /// values to be written must have timestamp within the online storage
    /// retention.
    pub fn write_feature_values(
        &self,
    ) -> super::builder::featurestore_online_serving_service::WriteFeatureValues {
        super::builder::featurestore_online_serving_service::WriteFeatureValues::new(
            self.inner.clone(),
        )
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(
        &self,
    ) -> super::builder::featurestore_online_serving_service::ListLocations {
        super::builder::featurestore_online_serving_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::featurestore_online_serving_service::GetLocation {
        super::builder::featurestore_online_serving_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(
        &self,
    ) -> super::builder::featurestore_online_serving_service::SetIamPolicy {
        super::builder::featurestore_online_serving_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(
        &self,
    ) -> super::builder::featurestore_online_serving_service::GetIamPolicy {
        super::builder::featurestore_online_serving_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::featurestore_online_serving_service::TestIamPermissions {
        super::builder::featurestore_online_serving_service::TestIamPermissions::new(
            self.inner.clone(),
        )
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(
        &self,
    ) -> super::builder::featurestore_online_serving_service::ListOperations {
        super::builder::featurestore_online_serving_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(
        &self,
    ) -> super::builder::featurestore_online_serving_service::GetOperation {
        super::builder::featurestore_online_serving_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(
        &self,
    ) -> super::builder::featurestore_online_serving_service::DeleteOperation {
        super::builder::featurestore_online_serving_service::DeleteOperation::new(
            self.inner.clone(),
        )
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(
        &self,
    ) -> super::builder::featurestore_online_serving_service::CancelOperation {
        super::builder::featurestore_online_serving_service::CancelOperation::new(
            self.inner.clone(),
        )
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(
        &self,
    ) -> super::builder::featurestore_online_serving_service::WaitOperation {
        super::builder::featurestore_online_serving_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
/// let client = FeaturestoreService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// The service that handles CRUD and List for resources for Featurestore.
///
/// # Configuration
///
/// To configure `FeaturestoreService` use the `with_*` methods in the type returned
/// by [builder()][FeaturestoreService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::featurestore_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::featurestore_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `FeaturestoreService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `FeaturestoreService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "featurestore-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-service")))]
#[derive(Clone, Debug)]
pub struct FeaturestoreService {
    inner: std::sync::Arc<dyn super::stub::dynamic::FeaturestoreService>,
}

#[cfg(feature = "featurestore-service")]
impl FeaturestoreService {
    /// Returns a builder for [FeaturestoreService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::FeaturestoreService;
    /// let client = FeaturestoreService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::featurestore_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::featurestore_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::FeaturestoreService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::FeaturestoreService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::FeaturestoreService> {
        super::transport::FeaturestoreService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::FeaturestoreService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::FeaturestoreService::new)
    }

    /// Creates a new Featurestore in a given project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_featurestore(&self) -> super::builder::featurestore_service::CreateFeaturestore {
        super::builder::featurestore_service::CreateFeaturestore::new(self.inner.clone())
    }

    /// Gets details of a single Featurestore.
    pub fn get_featurestore(&self) -> super::builder::featurestore_service::GetFeaturestore {
        super::builder::featurestore_service::GetFeaturestore::new(self.inner.clone())
    }

    /// Lists Featurestores in a given project and location.
    pub fn list_featurestores(&self) -> super::builder::featurestore_service::ListFeaturestores {
        super::builder::featurestore_service::ListFeaturestores::new(self.inner.clone())
    }

    /// Updates the parameters of a single Featurestore.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_featurestore(&self) -> super::builder::featurestore_service::UpdateFeaturestore {
        super::builder::featurestore_service::UpdateFeaturestore::new(self.inner.clone())
    }

    /// Deletes a single Featurestore. The Featurestore must not contain any
    /// EntityTypes or `force` must be set to true for the request to succeed.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_featurestore(&self) -> super::builder::featurestore_service::DeleteFeaturestore {
        super::builder::featurestore_service::DeleteFeaturestore::new(self.inner.clone())
    }

    /// Creates a new EntityType in a given Featurestore.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_entity_type(&self) -> super::builder::featurestore_service::CreateEntityType {
        super::builder::featurestore_service::CreateEntityType::new(self.inner.clone())
    }

    /// Gets details of a single EntityType.
    pub fn get_entity_type(&self) -> super::builder::featurestore_service::GetEntityType {
        super::builder::featurestore_service::GetEntityType::new(self.inner.clone())
    }

    /// Lists EntityTypes in a given Featurestore.
    pub fn list_entity_types(&self) -> super::builder::featurestore_service::ListEntityTypes {
        super::builder::featurestore_service::ListEntityTypes::new(self.inner.clone())
    }

    /// Updates the parameters of a single EntityType.
    pub fn update_entity_type(&self) -> super::builder::featurestore_service::UpdateEntityType {
        super::builder::featurestore_service::UpdateEntityType::new(self.inner.clone())
    }

    /// Deletes a single EntityType. The EntityType must not have any Features
    /// or `force` must be set to true for the request to succeed.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_entity_type(&self) -> super::builder::featurestore_service::DeleteEntityType {
        super::builder::featurestore_service::DeleteEntityType::new(self.inner.clone())
    }

    /// Creates a new Feature in a given EntityType.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_feature(&self) -> super::builder::featurestore_service::CreateFeature {
        super::builder::featurestore_service::CreateFeature::new(self.inner.clone())
    }

    /// Creates a batch of Features in a given EntityType.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_create_features(
        &self,
    ) -> super::builder::featurestore_service::BatchCreateFeatures {
        super::builder::featurestore_service::BatchCreateFeatures::new(self.inner.clone())
    }

    /// Gets details of a single Feature.
    pub fn get_feature(&self) -> super::builder::featurestore_service::GetFeature {
        super::builder::featurestore_service::GetFeature::new(self.inner.clone())
    }

    /// Lists Features in a given EntityType.
    pub fn list_features(&self) -> super::builder::featurestore_service::ListFeatures {
        super::builder::featurestore_service::ListFeatures::new(self.inner.clone())
    }

    /// Updates the parameters of a single Feature.
    pub fn update_feature(&self) -> super::builder::featurestore_service::UpdateFeature {
        super::builder::featurestore_service::UpdateFeature::new(self.inner.clone())
    }

    /// Deletes a single Feature.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_feature(&self) -> super::builder::featurestore_service::DeleteFeature {
        super::builder::featurestore_service::DeleteFeature::new(self.inner.clone())
    }

    /// Imports Feature values into the Featurestore from a source storage.
    ///
    /// The progress of the import is tracked by the returned operation. The
    /// imported features are guaranteed to be visible to subsequent read
    /// operations after the operation is marked as successfully done.
    ///
    /// If an import operation fails, the Feature values returned from
    /// reads and exports may be inconsistent. If consistency is
    /// required, the caller must retry the same import request again and wait till
    /// the new operation returned is marked as successfully done.
    ///
    /// There are also scenarios where the caller can cause inconsistency.
    ///
    /// - Source data for import contains multiple distinct Feature values for
    ///   the same entity ID and timestamp.
    /// - Source is modified during an import. This includes adding, updating, or
    ///   removing source data and/or metadata. Examples of updating metadata
    ///   include but are not limited to changing storage location, storage class,
    ///   or retention policy.
    /// - Online serving cluster is under-provisioned.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn import_feature_values(
        &self,
    ) -> super::builder::featurestore_service::ImportFeatureValues {
        super::builder::featurestore_service::ImportFeatureValues::new(self.inner.clone())
    }

    /// Batch reads Feature values from a Featurestore.
    ///
    /// This API enables batch reading Feature values, where each read
    /// instance in the batch may read Feature values of entities from one or
    /// more EntityTypes. Point-in-time correctness is guaranteed for Feature
    /// values of each read instance as of each instance's read timestamp.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_read_feature_values(
        &self,
    ) -> super::builder::featurestore_service::BatchReadFeatureValues {
        super::builder::featurestore_service::BatchReadFeatureValues::new(self.inner.clone())
    }

    /// Exports Feature values from all the entities of a target EntityType.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn export_feature_values(
        &self,
    ) -> super::builder::featurestore_service::ExportFeatureValues {
        super::builder::featurestore_service::ExportFeatureValues::new(self.inner.clone())
    }

    /// Delete Feature values from Featurestore.
    ///
    /// The progress of the deletion is tracked by the returned operation. The
    /// deleted feature values are guaranteed to be invisible to subsequent read
    /// operations after the operation is marked as successfully done.
    ///
    /// If a delete feature values operation fails, the feature values
    /// returned from reads and exports may be inconsistent. If consistency is
    /// required, the caller must retry the same delete request again and wait till
    /// the new operation returned is marked as successfully done.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_feature_values(
        &self,
    ) -> super::builder::featurestore_service::DeleteFeatureValues {
        super::builder::featurestore_service::DeleteFeatureValues::new(self.inner.clone())
    }

    /// Searches Features matching a query in a given project.
    pub fn search_features(&self) -> super::builder::featurestore_service::SearchFeatures {
        super::builder::featurestore_service::SearchFeatures::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::featurestore_service::ListLocations {
        super::builder::featurestore_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::featurestore_service::GetLocation {
        super::builder::featurestore_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::featurestore_service::SetIamPolicy {
        super::builder::featurestore_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::featurestore_service::GetIamPolicy {
        super::builder::featurestore_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::featurestore_service::TestIamPermissions {
        super::builder::featurestore_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::featurestore_service::ListOperations {
        super::builder::featurestore_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::featurestore_service::GetOperation {
        super::builder::featurestore_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::featurestore_service::DeleteOperation {
        super::builder::featurestore_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::featurestore_service::CancelOperation {
        super::builder::featurestore_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::featurestore_service::WaitOperation {
        super::builder::featurestore_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
/// let client = GenAiCacheService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing Vertex AI's CachedContent resource.
///
/// # Configuration
///
/// To configure `GenAiCacheService` use the `with_*` methods in the type returned
/// by [builder()][GenAiCacheService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::gen_ai_cache_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::gen_ai_cache_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `GenAiCacheService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `GenAiCacheService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "gen-ai-cache-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-cache-service")))]
#[derive(Clone, Debug)]
pub struct GenAiCacheService {
    inner: std::sync::Arc<dyn super::stub::dynamic::GenAiCacheService>,
}

#[cfg(feature = "gen-ai-cache-service")]
impl GenAiCacheService {
    /// Returns a builder for [GenAiCacheService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::GenAiCacheService;
    /// let client = GenAiCacheService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::gen_ai_cache_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::gen_ai_cache_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::GenAiCacheService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::GenAiCacheService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::GenAiCacheService> {
        super::transport::GenAiCacheService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::GenAiCacheService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::GenAiCacheService::new)
    }

    /// Creates cached content, this call will initialize the cached content in the
    /// data storage, and users need to pay for the cache data storage.
    pub fn create_cached_content(
        &self,
    ) -> super::builder::gen_ai_cache_service::CreateCachedContent {
        super::builder::gen_ai_cache_service::CreateCachedContent::new(self.inner.clone())
    }

    /// Gets cached content configurations
    pub fn get_cached_content(&self) -> super::builder::gen_ai_cache_service::GetCachedContent {
        super::builder::gen_ai_cache_service::GetCachedContent::new(self.inner.clone())
    }

    /// Updates cached content configurations
    pub fn update_cached_content(
        &self,
    ) -> super::builder::gen_ai_cache_service::UpdateCachedContent {
        super::builder::gen_ai_cache_service::UpdateCachedContent::new(self.inner.clone())
    }

    /// Deletes cached content
    pub fn delete_cached_content(
        &self,
    ) -> super::builder::gen_ai_cache_service::DeleteCachedContent {
        super::builder::gen_ai_cache_service::DeleteCachedContent::new(self.inner.clone())
    }

    /// Lists cached contents in a project
    pub fn list_cached_contents(&self) -> super::builder::gen_ai_cache_service::ListCachedContents {
        super::builder::gen_ai_cache_service::ListCachedContents::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::gen_ai_cache_service::ListLocations {
        super::builder::gen_ai_cache_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::gen_ai_cache_service::GetLocation {
        super::builder::gen_ai_cache_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::gen_ai_cache_service::SetIamPolicy {
        super::builder::gen_ai_cache_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::gen_ai_cache_service::GetIamPolicy {
        super::builder::gen_ai_cache_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::gen_ai_cache_service::TestIamPermissions {
        super::builder::gen_ai_cache_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::gen_ai_cache_service::ListOperations {
        super::builder::gen_ai_cache_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::gen_ai_cache_service::GetOperation {
        super::builder::gen_ai_cache_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::gen_ai_cache_service::DeleteOperation {
        super::builder::gen_ai_cache_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::gen_ai_cache_service::CancelOperation {
        super::builder::gen_ai_cache_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::gen_ai_cache_service::WaitOperation {
        super::builder::gen_ai_cache_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
/// let client = GenAiTuningService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for creating and managing GenAI Tuning Jobs.
///
/// # Configuration
///
/// To configure `GenAiTuningService` use the `with_*` methods in the type returned
/// by [builder()][GenAiTuningService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::gen_ai_tuning_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::gen_ai_tuning_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `GenAiTuningService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `GenAiTuningService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "gen-ai-tuning-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-tuning-service")))]
#[derive(Clone, Debug)]
pub struct GenAiTuningService {
    inner: std::sync::Arc<dyn super::stub::dynamic::GenAiTuningService>,
}

#[cfg(feature = "gen-ai-tuning-service")]
impl GenAiTuningService {
    /// Returns a builder for [GenAiTuningService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::GenAiTuningService;
    /// let client = GenAiTuningService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::gen_ai_tuning_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::gen_ai_tuning_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::GenAiTuningService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::GenAiTuningService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::GenAiTuningService> {
        super::transport::GenAiTuningService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::GenAiTuningService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::GenAiTuningService::new)
    }

    /// Creates a TuningJob. A created TuningJob right away will be attempted to
    /// be run.
    pub fn create_tuning_job(&self) -> super::builder::gen_ai_tuning_service::CreateTuningJob {
        super::builder::gen_ai_tuning_service::CreateTuningJob::new(self.inner.clone())
    }

    /// Gets a TuningJob.
    pub fn get_tuning_job(&self) -> super::builder::gen_ai_tuning_service::GetTuningJob {
        super::builder::gen_ai_tuning_service::GetTuningJob::new(self.inner.clone())
    }

    /// Lists TuningJobs in a Location.
    pub fn list_tuning_jobs(&self) -> super::builder::gen_ai_tuning_service::ListTuningJobs {
        super::builder::gen_ai_tuning_service::ListTuningJobs::new(self.inner.clone())
    }

    /// Cancels a TuningJob.
    /// Starts asynchronous cancellation on the TuningJob. The server makes a best
    /// effort to cancel the job, but success is not guaranteed. Clients can use
    /// [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob]
    /// or other methods to check whether the cancellation succeeded or whether the
    /// job completed despite cancellation. On successful cancellation, the
    /// TuningJob is not deleted; instead it becomes a job with a
    /// [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a
    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
    /// `Code.CANCELLED`, and
    /// [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to
    /// `CANCELLED`.
    ///
    /// [google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob]: crate::client::GenAiTuningService::get_tuning_job
    /// [google.cloud.aiplatform.v1.TuningJob.error]: crate::model::TuningJob::error
    /// [google.cloud.aiplatform.v1.TuningJob.state]: crate::model::TuningJob::state
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub fn cancel_tuning_job(&self) -> super::builder::gen_ai_tuning_service::CancelTuningJob {
        super::builder::gen_ai_tuning_service::CancelTuningJob::new(self.inner.clone())
    }

    /// Rebase a TunedModel.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn rebase_tuned_model(&self) -> super::builder::gen_ai_tuning_service::RebaseTunedModel {
        super::builder::gen_ai_tuning_service::RebaseTunedModel::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::gen_ai_tuning_service::ListLocations {
        super::builder::gen_ai_tuning_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::gen_ai_tuning_service::GetLocation {
        super::builder::gen_ai_tuning_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::gen_ai_tuning_service::SetIamPolicy {
        super::builder::gen_ai_tuning_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::gen_ai_tuning_service::GetIamPolicy {
        super::builder::gen_ai_tuning_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::gen_ai_tuning_service::TestIamPermissions {
        super::builder::gen_ai_tuning_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::gen_ai_tuning_service::ListOperations {
        super::builder::gen_ai_tuning_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::gen_ai_tuning_service::GetOperation {
        super::builder::gen_ai_tuning_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::gen_ai_tuning_service::DeleteOperation {
        super::builder::gen_ai_tuning_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::gen_ai_tuning_service::CancelOperation {
        super::builder::gen_ai_tuning_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::gen_ai_tuning_service::WaitOperation {
        super::builder::gen_ai_tuning_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
/// let client = IndexEndpointService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for managing Vertex AI's IndexEndpoints.
///
/// # Configuration
///
/// To configure `IndexEndpointService` use the `with_*` methods in the type returned
/// by [builder()][IndexEndpointService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::index_endpoint_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::index_endpoint_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `IndexEndpointService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `IndexEndpointService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "index-endpoint-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "index-endpoint-service")))]
#[derive(Clone, Debug)]
pub struct IndexEndpointService {
    inner: std::sync::Arc<dyn super::stub::dynamic::IndexEndpointService>,
}

#[cfg(feature = "index-endpoint-service")]
impl IndexEndpointService {
    /// Returns a builder for [IndexEndpointService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::IndexEndpointService;
    /// let client = IndexEndpointService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::index_endpoint_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::index_endpoint_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::IndexEndpointService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::IndexEndpointService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::IndexEndpointService> {
        super::transport::IndexEndpointService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::IndexEndpointService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::IndexEndpointService::new)
    }

    /// Creates an IndexEndpoint.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_index_endpoint(
        &self,
    ) -> super::builder::index_endpoint_service::CreateIndexEndpoint {
        super::builder::index_endpoint_service::CreateIndexEndpoint::new(self.inner.clone())
    }

    /// Gets an IndexEndpoint.
    pub fn get_index_endpoint(&self) -> super::builder::index_endpoint_service::GetIndexEndpoint {
        super::builder::index_endpoint_service::GetIndexEndpoint::new(self.inner.clone())
    }

    /// Lists IndexEndpoints in a Location.
    pub fn list_index_endpoints(
        &self,
    ) -> super::builder::index_endpoint_service::ListIndexEndpoints {
        super::builder::index_endpoint_service::ListIndexEndpoints::new(self.inner.clone())
    }

    /// Updates an IndexEndpoint.
    pub fn update_index_endpoint(
        &self,
    ) -> super::builder::index_endpoint_service::UpdateIndexEndpoint {
        super::builder::index_endpoint_service::UpdateIndexEndpoint::new(self.inner.clone())
    }

    /// Deletes an IndexEndpoint.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_index_endpoint(
        &self,
    ) -> super::builder::index_endpoint_service::DeleteIndexEndpoint {
        super::builder::index_endpoint_service::DeleteIndexEndpoint::new(self.inner.clone())
    }

    /// Deploys an Index into this IndexEndpoint, creating a DeployedIndex within
    /// it.
    /// Only non-empty Indexes can be deployed.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn deploy_index(&self) -> super::builder::index_endpoint_service::DeployIndex {
        super::builder::index_endpoint_service::DeployIndex::new(self.inner.clone())
    }

    /// Undeploys an Index from an IndexEndpoint, removing a DeployedIndex from it,
    /// and freeing all resources it's using.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn undeploy_index(&self) -> super::builder::index_endpoint_service::UndeployIndex {
        super::builder::index_endpoint_service::UndeployIndex::new(self.inner.clone())
    }

    /// Update an existing DeployedIndex under an IndexEndpoint.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn mutate_deployed_index(
        &self,
    ) -> super::builder::index_endpoint_service::MutateDeployedIndex {
        super::builder::index_endpoint_service::MutateDeployedIndex::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::index_endpoint_service::ListLocations {
        super::builder::index_endpoint_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::index_endpoint_service::GetLocation {
        super::builder::index_endpoint_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::index_endpoint_service::SetIamPolicy {
        super::builder::index_endpoint_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::index_endpoint_service::GetIamPolicy {
        super::builder::index_endpoint_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::index_endpoint_service::TestIamPermissions {
        super::builder::index_endpoint_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::index_endpoint_service::ListOperations {
        super::builder::index_endpoint_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::index_endpoint_service::GetOperation {
        super::builder::index_endpoint_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::index_endpoint_service::DeleteOperation {
        super::builder::index_endpoint_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::index_endpoint_service::CancelOperation {
        super::builder::index_endpoint_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::index_endpoint_service::WaitOperation {
        super::builder::index_endpoint_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::IndexService;
/// let client = IndexService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for creating and managing Vertex AI's Index resources.
///
/// # Configuration
///
/// To configure `IndexService` use the `with_*` methods in the type returned
/// by [builder()][IndexService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::index_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::index_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `IndexService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `IndexService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "index-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "index-service")))]
#[derive(Clone, Debug)]
pub struct IndexService {
    inner: std::sync::Arc<dyn super::stub::dynamic::IndexService>,
}

#[cfg(feature = "index-service")]
impl IndexService {
    /// Returns a builder for [IndexService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::IndexService;
    /// let client = IndexService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::index_service::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::index_service::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::IndexService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::IndexService>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::IndexService> {
        super::transport::IndexService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::IndexService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::IndexService::new)
    }

    /// Creates an Index.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_index(&self) -> super::builder::index_service::CreateIndex {
        super::builder::index_service::CreateIndex::new(self.inner.clone())
    }

    /// Gets an Index.
    pub fn get_index(&self) -> super::builder::index_service::GetIndex {
        super::builder::index_service::GetIndex::new(self.inner.clone())
    }

    /// Lists Indexes in a Location.
    pub fn list_indexes(&self) -> super::builder::index_service::ListIndexes {
        super::builder::index_service::ListIndexes::new(self.inner.clone())
    }

    /// Updates an Index.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_index(&self) -> super::builder::index_service::UpdateIndex {
        super::builder::index_service::UpdateIndex::new(self.inner.clone())
    }

    /// Deletes an Index.
    /// An Index can only be deleted when all its
    /// [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had
    /// been undeployed.
    ///
    /// [google.cloud.aiplatform.v1.Index.deployed_indexes]: crate::model::Index::deployed_indexes
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_index(&self) -> super::builder::index_service::DeleteIndex {
        super::builder::index_service::DeleteIndex::new(self.inner.clone())
    }

    /// Add/update Datapoints into an Index.
    pub fn upsert_datapoints(&self) -> super::builder::index_service::UpsertDatapoints {
        super::builder::index_service::UpsertDatapoints::new(self.inner.clone())
    }

    /// Remove Datapoints from an Index.
    pub fn remove_datapoints(&self) -> super::builder::index_service::RemoveDatapoints {
        super::builder::index_service::RemoveDatapoints::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::index_service::ListLocations {
        super::builder::index_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::index_service::GetLocation {
        super::builder::index_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::index_service::SetIamPolicy {
        super::builder::index_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::index_service::GetIamPolicy {
        super::builder::index_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::index_service::TestIamPermissions {
        super::builder::index_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::index_service::ListOperations {
        super::builder::index_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::index_service::GetOperation {
        super::builder::index_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::index_service::DeleteOperation {
        super::builder::index_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::index_service::CancelOperation {
        super::builder::index_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::index_service::WaitOperation {
        super::builder::index_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::JobService;
/// let client = JobService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for creating and managing Vertex AI's jobs.
///
/// # Configuration
///
/// To configure `JobService` use the `with_*` methods in the type returned
/// by [builder()][JobService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::job_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::job_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `JobService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `JobService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "job-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "job-service")))]
#[derive(Clone, Debug)]
pub struct JobService {
    inner: std::sync::Arc<dyn super::stub::dynamic::JobService>,
}

#[cfg(feature = "job-service")]
impl JobService {
    /// Returns a builder for [JobService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::JobService;
    /// let client = JobService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::job_service::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::job_service::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::JobService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::JobService>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::JobService> {
        super::transport::JobService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::JobService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::JobService::new)
    }

    /// Creates a CustomJob. A created CustomJob right away
    /// will be attempted to be run.
    pub fn create_custom_job(&self) -> super::builder::job_service::CreateCustomJob {
        super::builder::job_service::CreateCustomJob::new(self.inner.clone())
    }

    /// Gets a CustomJob.
    pub fn get_custom_job(&self) -> super::builder::job_service::GetCustomJob {
        super::builder::job_service::GetCustomJob::new(self.inner.clone())
    }

    /// Lists CustomJobs in a Location.
    pub fn list_custom_jobs(&self) -> super::builder::job_service::ListCustomJobs {
        super::builder::job_service::ListCustomJobs::new(self.inner.clone())
    }

    /// Deletes a CustomJob.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_custom_job(&self) -> super::builder::job_service::DeleteCustomJob {
        super::builder::job_service::DeleteCustomJob::new(self.inner.clone())
    }

    /// Cancels a CustomJob.
    /// Starts asynchronous cancellation on the CustomJob. The server
    /// makes a best effort to cancel the job, but success is not
    /// guaranteed. Clients can use
    /// [JobService.GetCustomJob][google.cloud.aiplatform.v1.JobService.GetCustomJob]
    /// or other methods to check whether the cancellation succeeded or whether the
    /// job completed despite cancellation. On successful cancellation,
    /// the CustomJob is not deleted; instead it becomes a job with
    /// a [CustomJob.error][google.cloud.aiplatform.v1.CustomJob.error] value with
    /// a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
    /// `Code.CANCELLED`, and
    /// [CustomJob.state][google.cloud.aiplatform.v1.CustomJob.state] is set to
    /// `CANCELLED`.
    ///
    /// [google.cloud.aiplatform.v1.CustomJob.error]: crate::model::CustomJob::error
    /// [google.cloud.aiplatform.v1.CustomJob.state]: crate::model::CustomJob::state
    /// [google.cloud.aiplatform.v1.JobService.GetCustomJob]: crate::client::JobService::get_custom_job
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub fn cancel_custom_job(&self) -> super::builder::job_service::CancelCustomJob {
        super::builder::job_service::CancelCustomJob::new(self.inner.clone())
    }

    /// Creates a DataLabelingJob.
    pub fn create_data_labeling_job(&self) -> super::builder::job_service::CreateDataLabelingJob {
        super::builder::job_service::CreateDataLabelingJob::new(self.inner.clone())
    }

    /// Gets a DataLabelingJob.
    pub fn get_data_labeling_job(&self) -> super::builder::job_service::GetDataLabelingJob {
        super::builder::job_service::GetDataLabelingJob::new(self.inner.clone())
    }

    /// Lists DataLabelingJobs in a Location.
    pub fn list_data_labeling_jobs(&self) -> super::builder::job_service::ListDataLabelingJobs {
        super::builder::job_service::ListDataLabelingJobs::new(self.inner.clone())
    }

    /// Deletes a DataLabelingJob.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_data_labeling_job(&self) -> super::builder::job_service::DeleteDataLabelingJob {
        super::builder::job_service::DeleteDataLabelingJob::new(self.inner.clone())
    }

    /// Cancels a DataLabelingJob. Success of cancellation is not guaranteed.
    pub fn cancel_data_labeling_job(&self) -> super::builder::job_service::CancelDataLabelingJob {
        super::builder::job_service::CancelDataLabelingJob::new(self.inner.clone())
    }

    /// Creates a HyperparameterTuningJob
    pub fn create_hyperparameter_tuning_job(
        &self,
    ) -> super::builder::job_service::CreateHyperparameterTuningJob {
        super::builder::job_service::CreateHyperparameterTuningJob::new(self.inner.clone())
    }

    /// Gets a HyperparameterTuningJob
    pub fn get_hyperparameter_tuning_job(
        &self,
    ) -> super::builder::job_service::GetHyperparameterTuningJob {
        super::builder::job_service::GetHyperparameterTuningJob::new(self.inner.clone())
    }

    /// Lists HyperparameterTuningJobs in a Location.
    pub fn list_hyperparameter_tuning_jobs(
        &self,
    ) -> super::builder::job_service::ListHyperparameterTuningJobs {
        super::builder::job_service::ListHyperparameterTuningJobs::new(self.inner.clone())
    }

    /// Deletes a HyperparameterTuningJob.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_hyperparameter_tuning_job(
        &self,
    ) -> super::builder::job_service::DeleteHyperparameterTuningJob {
        super::builder::job_service::DeleteHyperparameterTuningJob::new(self.inner.clone())
    }

    /// Cancels a HyperparameterTuningJob.
    /// Starts asynchronous cancellation on the HyperparameterTuningJob. The server
    /// makes a best effort to cancel the job, but success is not
    /// guaranteed. Clients can use
    /// [JobService.GetHyperparameterTuningJob][google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob]
    /// or other methods to check whether the cancellation succeeded or whether the
    /// job completed despite cancellation. On successful cancellation,
    /// the HyperparameterTuningJob is not deleted; instead it becomes a job with
    /// a
    /// [HyperparameterTuningJob.error][google.cloud.aiplatform.v1.HyperparameterTuningJob.error]
    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
    /// corresponding to `Code.CANCELLED`, and
    /// [HyperparameterTuningJob.state][google.cloud.aiplatform.v1.HyperparameterTuningJob.state]
    /// is set to `CANCELLED`.
    ///
    /// [google.cloud.aiplatform.v1.HyperparameterTuningJob.error]: crate::model::HyperparameterTuningJob::error
    /// [google.cloud.aiplatform.v1.HyperparameterTuningJob.state]: crate::model::HyperparameterTuningJob::state
    /// [google.cloud.aiplatform.v1.JobService.GetHyperparameterTuningJob]: crate::client::JobService::get_hyperparameter_tuning_job
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub fn cancel_hyperparameter_tuning_job(
        &self,
    ) -> super::builder::job_service::CancelHyperparameterTuningJob {
        super::builder::job_service::CancelHyperparameterTuningJob::new(self.inner.clone())
    }

    /// Creates a NasJob
    pub fn create_nas_job(&self) -> super::builder::job_service::CreateNasJob {
        super::builder::job_service::CreateNasJob::new(self.inner.clone())
    }

    /// Gets a NasJob
    pub fn get_nas_job(&self) -> super::builder::job_service::GetNasJob {
        super::builder::job_service::GetNasJob::new(self.inner.clone())
    }

    /// Lists NasJobs in a Location.
    pub fn list_nas_jobs(&self) -> super::builder::job_service::ListNasJobs {
        super::builder::job_service::ListNasJobs::new(self.inner.clone())
    }

    /// Deletes a NasJob.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_nas_job(&self) -> super::builder::job_service::DeleteNasJob {
        super::builder::job_service::DeleteNasJob::new(self.inner.clone())
    }

    /// Cancels a NasJob.
    /// Starts asynchronous cancellation on the NasJob. The server
    /// makes a best effort to cancel the job, but success is not
    /// guaranteed. Clients can use
    /// [JobService.GetNasJob][google.cloud.aiplatform.v1.JobService.GetNasJob] or
    /// other methods to check whether the cancellation succeeded or whether the
    /// job completed despite cancellation. On successful cancellation,
    /// the NasJob is not deleted; instead it becomes a job with
    /// a [NasJob.error][google.cloud.aiplatform.v1.NasJob.error] value with a
    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
    /// `Code.CANCELLED`, and
    /// [NasJob.state][google.cloud.aiplatform.v1.NasJob.state] is set to
    /// `CANCELLED`.
    ///
    /// [google.cloud.aiplatform.v1.JobService.GetNasJob]: crate::client::JobService::get_nas_job
    /// [google.cloud.aiplatform.v1.NasJob.error]: crate::model::NasJob::error
    /// [google.cloud.aiplatform.v1.NasJob.state]: crate::model::NasJob::state
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub fn cancel_nas_job(&self) -> super::builder::job_service::CancelNasJob {
        super::builder::job_service::CancelNasJob::new(self.inner.clone())
    }

    /// Gets a NasTrialDetail.
    pub fn get_nas_trial_detail(&self) -> super::builder::job_service::GetNasTrialDetail {
        super::builder::job_service::GetNasTrialDetail::new(self.inner.clone())
    }

    /// List top NasTrialDetails of a NasJob.
    pub fn list_nas_trial_details(&self) -> super::builder::job_service::ListNasTrialDetails {
        super::builder::job_service::ListNasTrialDetails::new(self.inner.clone())
    }

    /// Creates a BatchPredictionJob. A BatchPredictionJob once created will
    /// right away be attempted to start.
    pub fn create_batch_prediction_job(
        &self,
    ) -> super::builder::job_service::CreateBatchPredictionJob {
        super::builder::job_service::CreateBatchPredictionJob::new(self.inner.clone())
    }

    /// Gets a BatchPredictionJob
    pub fn get_batch_prediction_job(&self) -> super::builder::job_service::GetBatchPredictionJob {
        super::builder::job_service::GetBatchPredictionJob::new(self.inner.clone())
    }

    /// Lists BatchPredictionJobs in a Location.
    pub fn list_batch_prediction_jobs(
        &self,
    ) -> super::builder::job_service::ListBatchPredictionJobs {
        super::builder::job_service::ListBatchPredictionJobs::new(self.inner.clone())
    }

    /// Deletes a BatchPredictionJob. Can only be called on jobs that already
    /// finished.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_batch_prediction_job(
        &self,
    ) -> super::builder::job_service::DeleteBatchPredictionJob {
        super::builder::job_service::DeleteBatchPredictionJob::new(self.inner.clone())
    }

    /// Cancels a BatchPredictionJob.
    ///
    /// Starts asynchronous cancellation on the BatchPredictionJob. The server
    /// makes the best effort to cancel the job, but success is not
    /// guaranteed. Clients can use
    /// [JobService.GetBatchPredictionJob][google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob]
    /// or other methods to check whether the cancellation succeeded or whether the
    /// job completed despite cancellation. On a successful cancellation,
    /// the BatchPredictionJob is not deleted;instead its
    /// [BatchPredictionJob.state][google.cloud.aiplatform.v1.BatchPredictionJob.state]
    /// is set to `CANCELLED`. Any files already outputted by the job are not
    /// deleted.
    ///
    /// [google.cloud.aiplatform.v1.BatchPredictionJob.state]: crate::model::BatchPredictionJob::state
    /// [google.cloud.aiplatform.v1.JobService.GetBatchPredictionJob]: crate::client::JobService::get_batch_prediction_job
    pub fn cancel_batch_prediction_job(
        &self,
    ) -> super::builder::job_service::CancelBatchPredictionJob {
        super::builder::job_service::CancelBatchPredictionJob::new(self.inner.clone())
    }

    /// Creates a ModelDeploymentMonitoringJob. It will run periodically on a
    /// configured interval.
    pub fn create_model_deployment_monitoring_job(
        &self,
    ) -> super::builder::job_service::CreateModelDeploymentMonitoringJob {
        super::builder::job_service::CreateModelDeploymentMonitoringJob::new(self.inner.clone())
    }

    /// Searches Model Monitoring Statistics generated within a given time window.
    pub fn search_model_deployment_monitoring_stats_anomalies(
        &self,
    ) -> super::builder::job_service::SearchModelDeploymentMonitoringStatsAnomalies {
        super::builder::job_service::SearchModelDeploymentMonitoringStatsAnomalies::new(
            self.inner.clone(),
        )
    }

    /// Gets a ModelDeploymentMonitoringJob.
    pub fn get_model_deployment_monitoring_job(
        &self,
    ) -> super::builder::job_service::GetModelDeploymentMonitoringJob {
        super::builder::job_service::GetModelDeploymentMonitoringJob::new(self.inner.clone())
    }

    /// Lists ModelDeploymentMonitoringJobs in a Location.
    pub fn list_model_deployment_monitoring_jobs(
        &self,
    ) -> super::builder::job_service::ListModelDeploymentMonitoringJobs {
        super::builder::job_service::ListModelDeploymentMonitoringJobs::new(self.inner.clone())
    }

    /// Updates a ModelDeploymentMonitoringJob.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_model_deployment_monitoring_job(
        &self,
    ) -> super::builder::job_service::UpdateModelDeploymentMonitoringJob {
        super::builder::job_service::UpdateModelDeploymentMonitoringJob::new(self.inner.clone())
    }

    /// Deletes a ModelDeploymentMonitoringJob.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_model_deployment_monitoring_job(
        &self,
    ) -> super::builder::job_service::DeleteModelDeploymentMonitoringJob {
        super::builder::job_service::DeleteModelDeploymentMonitoringJob::new(self.inner.clone())
    }

    /// Pauses a ModelDeploymentMonitoringJob. If the job is running, the server
    /// makes a best effort to cancel the job. Will mark
    /// [ModelDeploymentMonitoringJob.state][google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state]
    /// to 'PAUSED'.
    ///
    /// [google.cloud.aiplatform.v1.ModelDeploymentMonitoringJob.state]: crate::model::ModelDeploymentMonitoringJob::state
    pub fn pause_model_deployment_monitoring_job(
        &self,
    ) -> super::builder::job_service::PauseModelDeploymentMonitoringJob {
        super::builder::job_service::PauseModelDeploymentMonitoringJob::new(self.inner.clone())
    }

    /// Resumes a paused ModelDeploymentMonitoringJob. It will start to run from
    /// next scheduled time. A deleted ModelDeploymentMonitoringJob can't be
    /// resumed.
    pub fn resume_model_deployment_monitoring_job(
        &self,
    ) -> super::builder::job_service::ResumeModelDeploymentMonitoringJob {
        super::builder::job_service::ResumeModelDeploymentMonitoringJob::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::job_service::ListLocations {
        super::builder::job_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::job_service::GetLocation {
        super::builder::job_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::job_service::SetIamPolicy {
        super::builder::job_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::job_service::GetIamPolicy {
        super::builder::job_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::job_service::TestIamPermissions {
        super::builder::job_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::job_service::ListOperations {
        super::builder::job_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::job_service::GetOperation {
        super::builder::job_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::job_service::DeleteOperation {
        super::builder::job_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::job_service::CancelOperation {
        super::builder::job_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::job_service::WaitOperation {
        super::builder::job_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
/// let client = LlmUtilityService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for LLM related utility functions.
///
/// # Configuration
///
/// To configure `LlmUtilityService` use the `with_*` methods in the type returned
/// by [builder()][LlmUtilityService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::llm_utility_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::llm_utility_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `LlmUtilityService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `LlmUtilityService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "llm-utility-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "llm-utility-service")))]
#[derive(Clone, Debug)]
pub struct LlmUtilityService {
    inner: std::sync::Arc<dyn super::stub::dynamic::LlmUtilityService>,
}

#[cfg(feature = "llm-utility-service")]
impl LlmUtilityService {
    /// Returns a builder for [LlmUtilityService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::LlmUtilityService;
    /// let client = LlmUtilityService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::llm_utility_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::llm_utility_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::LlmUtilityService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::LlmUtilityService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::LlmUtilityService> {
        super::transport::LlmUtilityService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::LlmUtilityService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::LlmUtilityService::new)
    }

    /// Perform a token counting.
    pub fn count_tokens(&self) -> super::builder::llm_utility_service::CountTokens {
        super::builder::llm_utility_service::CountTokens::new(self.inner.clone())
    }

    /// Return a list of tokens based on the input text.
    pub fn compute_tokens(&self) -> super::builder::llm_utility_service::ComputeTokens {
        super::builder::llm_utility_service::ComputeTokens::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::llm_utility_service::ListLocations {
        super::builder::llm_utility_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::llm_utility_service::GetLocation {
        super::builder::llm_utility_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::llm_utility_service::SetIamPolicy {
        super::builder::llm_utility_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::llm_utility_service::GetIamPolicy {
        super::builder::llm_utility_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::llm_utility_service::TestIamPermissions {
        super::builder::llm_utility_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::llm_utility_service::ListOperations {
        super::builder::llm_utility_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::llm_utility_service::GetOperation {
        super::builder::llm_utility_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::llm_utility_service::DeleteOperation {
        super::builder::llm_utility_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::llm_utility_service::CancelOperation {
        super::builder::llm_utility_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::llm_utility_service::WaitOperation {
        super::builder::llm_utility_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::MatchService;
/// let client = MatchService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// MatchService is a Google managed service for efficient vector similarity
/// search at scale.
///
/// # Configuration
///
/// To configure `MatchService` use the `with_*` methods in the type returned
/// by [builder()][MatchService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::match_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::match_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `MatchService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `MatchService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "match-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "match-service")))]
#[derive(Clone, Debug)]
pub struct MatchService {
    inner: std::sync::Arc<dyn super::stub::dynamic::MatchService>,
}

#[cfg(feature = "match-service")]
impl MatchService {
    /// Returns a builder for [MatchService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::MatchService;
    /// let client = MatchService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::match_service::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::match_service::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::MatchService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::MatchService>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::MatchService> {
        super::transport::MatchService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::MatchService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::MatchService::new)
    }

    /// Finds the nearest neighbors of each vector within the request.
    pub fn find_neighbors(&self) -> super::builder::match_service::FindNeighbors {
        super::builder::match_service::FindNeighbors::new(self.inner.clone())
    }

    /// Reads the datapoints/vectors of the given IDs.
    /// A maximum of 1000 datapoints can be retrieved in a batch.
    pub fn read_index_datapoints(&self) -> super::builder::match_service::ReadIndexDatapoints {
        super::builder::match_service::ReadIndexDatapoints::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::match_service::ListLocations {
        super::builder::match_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::match_service::GetLocation {
        super::builder::match_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::match_service::SetIamPolicy {
        super::builder::match_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::match_service::GetIamPolicy {
        super::builder::match_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::match_service::TestIamPermissions {
        super::builder::match_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::match_service::ListOperations {
        super::builder::match_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::match_service::GetOperation {
        super::builder::match_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::match_service::DeleteOperation {
        super::builder::match_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::match_service::CancelOperation {
        super::builder::match_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::match_service::WaitOperation {
        super::builder::match_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::MetadataService;
/// let client = MetadataService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for reading and writing metadata entries.
///
/// # Configuration
///
/// To configure `MetadataService` use the `with_*` methods in the type returned
/// by [builder()][MetadataService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::metadata_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::metadata_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `MetadataService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `MetadataService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "metadata-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "metadata-service")))]
#[derive(Clone, Debug)]
pub struct MetadataService {
    inner: std::sync::Arc<dyn super::stub::dynamic::MetadataService>,
}

#[cfg(feature = "metadata-service")]
impl MetadataService {
    /// Returns a builder for [MetadataService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::MetadataService;
    /// let client = MetadataService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::metadata_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::metadata_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::MetadataService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::MetadataService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::MetadataService> {
        super::transport::MetadataService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::MetadataService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::MetadataService::new)
    }

    /// Initializes a MetadataStore, including allocation of resources.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_metadata_store(&self) -> super::builder::metadata_service::CreateMetadataStore {
        super::builder::metadata_service::CreateMetadataStore::new(self.inner.clone())
    }

    /// Retrieves a specific MetadataStore.
    pub fn get_metadata_store(&self) -> super::builder::metadata_service::GetMetadataStore {
        super::builder::metadata_service::GetMetadataStore::new(self.inner.clone())
    }

    /// Lists MetadataStores for a Location.
    pub fn list_metadata_stores(&self) -> super::builder::metadata_service::ListMetadataStores {
        super::builder::metadata_service::ListMetadataStores::new(self.inner.clone())
    }

    /// Deletes a single MetadataStore and all its child resources (Artifacts,
    /// Executions, and Contexts).
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_metadata_store(&self) -> super::builder::metadata_service::DeleteMetadataStore {
        super::builder::metadata_service::DeleteMetadataStore::new(self.inner.clone())
    }

    /// Creates an Artifact associated with a MetadataStore.
    pub fn create_artifact(&self) -> super::builder::metadata_service::CreateArtifact {
        super::builder::metadata_service::CreateArtifact::new(self.inner.clone())
    }

    /// Retrieves a specific Artifact.
    pub fn get_artifact(&self) -> super::builder::metadata_service::GetArtifact {
        super::builder::metadata_service::GetArtifact::new(self.inner.clone())
    }

    /// Lists Artifacts in the MetadataStore.
    pub fn list_artifacts(&self) -> super::builder::metadata_service::ListArtifacts {
        super::builder::metadata_service::ListArtifacts::new(self.inner.clone())
    }

    /// Updates a stored Artifact.
    pub fn update_artifact(&self) -> super::builder::metadata_service::UpdateArtifact {
        super::builder::metadata_service::UpdateArtifact::new(self.inner.clone())
    }

    /// Deletes an Artifact.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_artifact(&self) -> super::builder::metadata_service::DeleteArtifact {
        super::builder::metadata_service::DeleteArtifact::new(self.inner.clone())
    }

    /// Purges Artifacts.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn purge_artifacts(&self) -> super::builder::metadata_service::PurgeArtifacts {
        super::builder::metadata_service::PurgeArtifacts::new(self.inner.clone())
    }

    /// Creates a Context associated with a MetadataStore.
    pub fn create_context(&self) -> super::builder::metadata_service::CreateContext {
        super::builder::metadata_service::CreateContext::new(self.inner.clone())
    }

    /// Retrieves a specific Context.
    pub fn get_context(&self) -> super::builder::metadata_service::GetContext {
        super::builder::metadata_service::GetContext::new(self.inner.clone())
    }

    /// Lists Contexts on the MetadataStore.
    pub fn list_contexts(&self) -> super::builder::metadata_service::ListContexts {
        super::builder::metadata_service::ListContexts::new(self.inner.clone())
    }

    /// Updates a stored Context.
    pub fn update_context(&self) -> super::builder::metadata_service::UpdateContext {
        super::builder::metadata_service::UpdateContext::new(self.inner.clone())
    }

    /// Deletes a stored Context.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_context(&self) -> super::builder::metadata_service::DeleteContext {
        super::builder::metadata_service::DeleteContext::new(self.inner.clone())
    }

    /// Purges Contexts.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn purge_contexts(&self) -> super::builder::metadata_service::PurgeContexts {
        super::builder::metadata_service::PurgeContexts::new(self.inner.clone())
    }

    /// Adds a set of Artifacts and Executions to a Context. If any of the
    /// Artifacts or Executions have already been added to a Context, they are
    /// simply skipped.
    pub fn add_context_artifacts_and_executions(
        &self,
    ) -> super::builder::metadata_service::AddContextArtifactsAndExecutions {
        super::builder::metadata_service::AddContextArtifactsAndExecutions::new(self.inner.clone())
    }

    /// Adds a set of Contexts as children to a parent Context. If any of the
    /// child Contexts have already been added to the parent Context, they are
    /// simply skipped. If this call would create a cycle or cause any Context to
    /// have more than 10 parents, the request will fail with an INVALID_ARGUMENT
    /// error.
    pub fn add_context_children(&self) -> super::builder::metadata_service::AddContextChildren {
        super::builder::metadata_service::AddContextChildren::new(self.inner.clone())
    }

    /// Remove a set of children contexts from a parent Context. If any of the
    /// child Contexts were NOT added to the parent Context, they are
    /// simply skipped.
    pub fn remove_context_children(
        &self,
    ) -> super::builder::metadata_service::RemoveContextChildren {
        super::builder::metadata_service::RemoveContextChildren::new(self.inner.clone())
    }

    /// Retrieves Artifacts and Executions within the specified Context, connected
    /// by Event edges and returned as a LineageSubgraph.
    pub fn query_context_lineage_subgraph(
        &self,
    ) -> super::builder::metadata_service::QueryContextLineageSubgraph {
        super::builder::metadata_service::QueryContextLineageSubgraph::new(self.inner.clone())
    }

    /// Creates an Execution associated with a MetadataStore.
    pub fn create_execution(&self) -> super::builder::metadata_service::CreateExecution {
        super::builder::metadata_service::CreateExecution::new(self.inner.clone())
    }

    /// Retrieves a specific Execution.
    pub fn get_execution(&self) -> super::builder::metadata_service::GetExecution {
        super::builder::metadata_service::GetExecution::new(self.inner.clone())
    }

    /// Lists Executions in the MetadataStore.
    pub fn list_executions(&self) -> super::builder::metadata_service::ListExecutions {
        super::builder::metadata_service::ListExecutions::new(self.inner.clone())
    }

    /// Updates a stored Execution.
    pub fn update_execution(&self) -> super::builder::metadata_service::UpdateExecution {
        super::builder::metadata_service::UpdateExecution::new(self.inner.clone())
    }

    /// Deletes an Execution.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_execution(&self) -> super::builder::metadata_service::DeleteExecution {
        super::builder::metadata_service::DeleteExecution::new(self.inner.clone())
    }

    /// Purges Executions.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn purge_executions(&self) -> super::builder::metadata_service::PurgeExecutions {
        super::builder::metadata_service::PurgeExecutions::new(self.inner.clone())
    }

    /// Adds Events to the specified Execution. An Event indicates whether an
    /// Artifact was used as an input or output for an Execution. If an Event
    /// already exists between the Execution and the Artifact, the Event is
    /// skipped.
    pub fn add_execution_events(&self) -> super::builder::metadata_service::AddExecutionEvents {
        super::builder::metadata_service::AddExecutionEvents::new(self.inner.clone())
    }

    /// Obtains the set of input and output Artifacts for this Execution, in the
    /// form of LineageSubgraph that also contains the Execution and connecting
    /// Events.
    pub fn query_execution_inputs_and_outputs(
        &self,
    ) -> super::builder::metadata_service::QueryExecutionInputsAndOutputs {
        super::builder::metadata_service::QueryExecutionInputsAndOutputs::new(self.inner.clone())
    }

    /// Creates a MetadataSchema.
    pub fn create_metadata_schema(&self) -> super::builder::metadata_service::CreateMetadataSchema {
        super::builder::metadata_service::CreateMetadataSchema::new(self.inner.clone())
    }

    /// Retrieves a specific MetadataSchema.
    pub fn get_metadata_schema(&self) -> super::builder::metadata_service::GetMetadataSchema {
        super::builder::metadata_service::GetMetadataSchema::new(self.inner.clone())
    }

    /// Lists MetadataSchemas.
    pub fn list_metadata_schemas(&self) -> super::builder::metadata_service::ListMetadataSchemas {
        super::builder::metadata_service::ListMetadataSchemas::new(self.inner.clone())
    }

    /// Retrieves lineage of an Artifact represented through Artifacts and
    /// Executions connected by Event edges and returned as a LineageSubgraph.
    pub fn query_artifact_lineage_subgraph(
        &self,
    ) -> super::builder::metadata_service::QueryArtifactLineageSubgraph {
        super::builder::metadata_service::QueryArtifactLineageSubgraph::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::metadata_service::ListLocations {
        super::builder::metadata_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::metadata_service::GetLocation {
        super::builder::metadata_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::metadata_service::SetIamPolicy {
        super::builder::metadata_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::metadata_service::GetIamPolicy {
        super::builder::metadata_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::metadata_service::TestIamPermissions {
        super::builder::metadata_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::metadata_service::ListOperations {
        super::builder::metadata_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::metadata_service::GetOperation {
        super::builder::metadata_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::metadata_service::DeleteOperation {
        super::builder::metadata_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::metadata_service::CancelOperation {
        super::builder::metadata_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::metadata_service::WaitOperation {
        super::builder::metadata_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::MigrationService;
/// let client = MigrationService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service that migrates resources from automl.googleapis.com,
/// datalabeling.googleapis.com and ml.googleapis.com to Vertex AI.
///
/// # Configuration
///
/// To configure `MigrationService` use the `with_*` methods in the type returned
/// by [builder()][MigrationService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::migration_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::migration_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `MigrationService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `MigrationService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "migration-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "migration-service")))]
#[derive(Clone, Debug)]
pub struct MigrationService {
    inner: std::sync::Arc<dyn super::stub::dynamic::MigrationService>,
}

#[cfg(feature = "migration-service")]
impl MigrationService {
    /// Returns a builder for [MigrationService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::MigrationService;
    /// let client = MigrationService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::migration_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::migration_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::MigrationService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::MigrationService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::MigrationService> {
        super::transport::MigrationService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::MigrationService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::MigrationService::new)
    }

    /// Searches all of the resources in automl.googleapis.com,
    /// datalabeling.googleapis.com and ml.googleapis.com that can be migrated to
    /// Vertex AI's given location.
    pub fn search_migratable_resources(
        &self,
    ) -> super::builder::migration_service::SearchMigratableResources {
        super::builder::migration_service::SearchMigratableResources::new(self.inner.clone())
    }

    /// Batch migrates resources from ml.googleapis.com, automl.googleapis.com,
    /// and datalabeling.googleapis.com to Vertex AI.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_migrate_resources(
        &self,
    ) -> super::builder::migration_service::BatchMigrateResources {
        super::builder::migration_service::BatchMigrateResources::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::migration_service::ListLocations {
        super::builder::migration_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::migration_service::GetLocation {
        super::builder::migration_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::migration_service::SetIamPolicy {
        super::builder::migration_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::migration_service::GetIamPolicy {
        super::builder::migration_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::migration_service::TestIamPermissions {
        super::builder::migration_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::migration_service::ListOperations {
        super::builder::migration_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::migration_service::GetOperation {
        super::builder::migration_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::migration_service::DeleteOperation {
        super::builder::migration_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::migration_service::CancelOperation {
        super::builder::migration_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::migration_service::WaitOperation {
        super::builder::migration_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::ModelGardenService;
/// let client = ModelGardenService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// The interface of Model Garden Service.
///
/// # Configuration
///
/// To configure `ModelGardenService` use the `with_*` methods in the type returned
/// by [builder()][ModelGardenService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::model_garden_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::model_garden_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `ModelGardenService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `ModelGardenService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "model-garden-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "model-garden-service")))]
#[derive(Clone, Debug)]
pub struct ModelGardenService {
    inner: std::sync::Arc<dyn super::stub::dynamic::ModelGardenService>,
}

#[cfg(feature = "model-garden-service")]
impl ModelGardenService {
    /// Returns a builder for [ModelGardenService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::ModelGardenService;
    /// let client = ModelGardenService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::model_garden_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::model_garden_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::ModelGardenService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ModelGardenService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ModelGardenService> {
        super::transport::ModelGardenService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ModelGardenService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::ModelGardenService::new)
    }

    /// Gets a Model Garden publisher model.
    pub fn get_publisher_model(&self) -> super::builder::model_garden_service::GetPublisherModel {
        super::builder::model_garden_service::GetPublisherModel::new(self.inner.clone())
    }

    /// Deploys a model to a new endpoint.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn deploy(&self) -> super::builder::model_garden_service::Deploy {
        super::builder::model_garden_service::Deploy::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::model_garden_service::ListLocations {
        super::builder::model_garden_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::model_garden_service::GetLocation {
        super::builder::model_garden_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::model_garden_service::SetIamPolicy {
        super::builder::model_garden_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::model_garden_service::GetIamPolicy {
        super::builder::model_garden_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::model_garden_service::TestIamPermissions {
        super::builder::model_garden_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::model_garden_service::ListOperations {
        super::builder::model_garden_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::model_garden_service::GetOperation {
        super::builder::model_garden_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::model_garden_service::DeleteOperation {
        super::builder::model_garden_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::model_garden_service::CancelOperation {
        super::builder::model_garden_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::model_garden_service::WaitOperation {
        super::builder::model_garden_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::ModelService;
/// let client = ModelService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for managing Vertex AI's machine learning Models.
///
/// # Configuration
///
/// To configure `ModelService` use the `with_*` methods in the type returned
/// by [builder()][ModelService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::model_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::model_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `ModelService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `ModelService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "model-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "model-service")))]
#[derive(Clone, Debug)]
pub struct ModelService {
    inner: std::sync::Arc<dyn super::stub::dynamic::ModelService>,
}

#[cfg(feature = "model-service")]
impl ModelService {
    /// Returns a builder for [ModelService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::ModelService;
    /// let client = ModelService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::model_service::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::model_service::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::ModelService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ModelService>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ModelService> {
        super::transport::ModelService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ModelService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::ModelService::new)
    }

    /// Uploads a Model artifact into Vertex AI.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn upload_model(&self) -> super::builder::model_service::UploadModel {
        super::builder::model_service::UploadModel::new(self.inner.clone())
    }

    /// Gets a Model.
    pub fn get_model(&self) -> super::builder::model_service::GetModel {
        super::builder::model_service::GetModel::new(self.inner.clone())
    }

    /// Lists Models in a Location.
    pub fn list_models(&self) -> super::builder::model_service::ListModels {
        super::builder::model_service::ListModels::new(self.inner.clone())
    }

    /// Lists versions of the specified model.
    pub fn list_model_versions(&self) -> super::builder::model_service::ListModelVersions {
        super::builder::model_service::ListModelVersions::new(self.inner.clone())
    }

    /// Lists checkpoints of the specified model version.
    pub fn list_model_version_checkpoints(
        &self,
    ) -> super::builder::model_service::ListModelVersionCheckpoints {
        super::builder::model_service::ListModelVersionCheckpoints::new(self.inner.clone())
    }

    /// Updates a Model.
    pub fn update_model(&self) -> super::builder::model_service::UpdateModel {
        super::builder::model_service::UpdateModel::new(self.inner.clone())
    }

    /// Incrementally update the dataset used for an examples model.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_explanation_dataset(
        &self,
    ) -> super::builder::model_service::UpdateExplanationDataset {
        super::builder::model_service::UpdateExplanationDataset::new(self.inner.clone())
    }

    /// Deletes a Model.
    ///
    /// A model cannot be deleted if any
    /// [Endpoint][google.cloud.aiplatform.v1.Endpoint] resource has a
    /// [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] based on the
    /// model in its
    /// [deployed_models][google.cloud.aiplatform.v1.Endpoint.deployed_models]
    /// field.
    ///
    /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
    /// [google.cloud.aiplatform.v1.Endpoint]: crate::model::Endpoint
    /// [google.cloud.aiplatform.v1.Endpoint.deployed_models]: crate::model::Endpoint::deployed_models
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_model(&self) -> super::builder::model_service::DeleteModel {
        super::builder::model_service::DeleteModel::new(self.inner.clone())
    }

    /// Deletes a Model version.
    ///
    /// Model version can only be deleted if there are no
    /// [DeployedModels][google.cloud.aiplatform.v1.DeployedModel] created from it.
    /// Deleting the only version in the Model is not allowed. Use
    /// [DeleteModel][google.cloud.aiplatform.v1.ModelService.DeleteModel] for
    /// deleting the Model instead.
    ///
    /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
    /// [google.cloud.aiplatform.v1.ModelService.DeleteModel]: crate::client::ModelService::delete_model
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_model_version(&self) -> super::builder::model_service::DeleteModelVersion {
        super::builder::model_service::DeleteModelVersion::new(self.inner.clone())
    }

    /// Merges a set of aliases for a Model version.
    pub fn merge_version_aliases(&self) -> super::builder::model_service::MergeVersionAliases {
        super::builder::model_service::MergeVersionAliases::new(self.inner.clone())
    }

    /// Exports a trained, exportable Model to a location specified by the
    /// user. A Model is considered to be exportable if it has at least one
    /// [supported export
    /// format][google.cloud.aiplatform.v1.Model.supported_export_formats].
    ///
    /// [google.cloud.aiplatform.v1.Model.supported_export_formats]: crate::model::Model::supported_export_formats
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn export_model(&self) -> super::builder::model_service::ExportModel {
        super::builder::model_service::ExportModel::new(self.inner.clone())
    }

    /// Copies an already existing Vertex AI Model into the specified Location.
    /// The source Model must exist in the same Project.
    /// When copying custom Models, the users themselves are responsible for
    /// [Model.metadata][google.cloud.aiplatform.v1.Model.metadata] content to be
    /// region-agnostic, as well as making sure that any resources (e.g. files) it
    /// depends on remain accessible.
    ///
    /// [google.cloud.aiplatform.v1.Model.metadata]: crate::model::Model::metadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn copy_model(&self) -> super::builder::model_service::CopyModel {
        super::builder::model_service::CopyModel::new(self.inner.clone())
    }

    /// Imports an externally generated ModelEvaluation.
    pub fn import_model_evaluation(&self) -> super::builder::model_service::ImportModelEvaluation {
        super::builder::model_service::ImportModelEvaluation::new(self.inner.clone())
    }

    /// Imports a list of externally generated ModelEvaluationSlice.
    pub fn batch_import_model_evaluation_slices(
        &self,
    ) -> super::builder::model_service::BatchImportModelEvaluationSlices {
        super::builder::model_service::BatchImportModelEvaluationSlices::new(self.inner.clone())
    }

    /// Imports a list of externally generated EvaluatedAnnotations.
    pub fn batch_import_evaluated_annotations(
        &self,
    ) -> super::builder::model_service::BatchImportEvaluatedAnnotations {
        super::builder::model_service::BatchImportEvaluatedAnnotations::new(self.inner.clone())
    }

    /// Gets a ModelEvaluation.
    pub fn get_model_evaluation(&self) -> super::builder::model_service::GetModelEvaluation {
        super::builder::model_service::GetModelEvaluation::new(self.inner.clone())
    }

    /// Lists ModelEvaluations in a Model.
    pub fn list_model_evaluations(&self) -> super::builder::model_service::ListModelEvaluations {
        super::builder::model_service::ListModelEvaluations::new(self.inner.clone())
    }

    /// Gets a ModelEvaluationSlice.
    pub fn get_model_evaluation_slice(
        &self,
    ) -> super::builder::model_service::GetModelEvaluationSlice {
        super::builder::model_service::GetModelEvaluationSlice::new(self.inner.clone())
    }

    /// Lists ModelEvaluationSlices in a ModelEvaluation.
    pub fn list_model_evaluation_slices(
        &self,
    ) -> super::builder::model_service::ListModelEvaluationSlices {
        super::builder::model_service::ListModelEvaluationSlices::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::model_service::ListLocations {
        super::builder::model_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::model_service::GetLocation {
        super::builder::model_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::model_service::SetIamPolicy {
        super::builder::model_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::model_service::GetIamPolicy {
        super::builder::model_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::model_service::TestIamPermissions {
        super::builder::model_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::model_service::ListOperations {
        super::builder::model_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::model_service::GetOperation {
        super::builder::model_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::model_service::DeleteOperation {
        super::builder::model_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::model_service::CancelOperation {
        super::builder::model_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::model_service::WaitOperation {
        super::builder::model_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::NotebookService;
/// let client = NotebookService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// The interface for Vertex Notebook service (a.k.a. Colab on Workbench).
///
/// # Configuration
///
/// To configure `NotebookService` use the `with_*` methods in the type returned
/// by [builder()][NotebookService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::notebook_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::notebook_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `NotebookService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `NotebookService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "notebook-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "notebook-service")))]
#[derive(Clone, Debug)]
pub struct NotebookService {
    inner: std::sync::Arc<dyn super::stub::dynamic::NotebookService>,
}

#[cfg(feature = "notebook-service")]
impl NotebookService {
    /// Returns a builder for [NotebookService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::NotebookService;
    /// let client = NotebookService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::notebook_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::notebook_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::NotebookService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::NotebookService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::NotebookService> {
        super::transport::NotebookService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::NotebookService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::NotebookService::new)
    }

    /// Creates a NotebookRuntimeTemplate.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_notebook_runtime_template(
        &self,
    ) -> super::builder::notebook_service::CreateNotebookRuntimeTemplate {
        super::builder::notebook_service::CreateNotebookRuntimeTemplate::new(self.inner.clone())
    }

    /// Gets a NotebookRuntimeTemplate.
    pub fn get_notebook_runtime_template(
        &self,
    ) -> super::builder::notebook_service::GetNotebookRuntimeTemplate {
        super::builder::notebook_service::GetNotebookRuntimeTemplate::new(self.inner.clone())
    }

    /// Lists NotebookRuntimeTemplates in a Location.
    pub fn list_notebook_runtime_templates(
        &self,
    ) -> super::builder::notebook_service::ListNotebookRuntimeTemplates {
        super::builder::notebook_service::ListNotebookRuntimeTemplates::new(self.inner.clone())
    }

    /// Deletes a NotebookRuntimeTemplate.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_notebook_runtime_template(
        &self,
    ) -> super::builder::notebook_service::DeleteNotebookRuntimeTemplate {
        super::builder::notebook_service::DeleteNotebookRuntimeTemplate::new(self.inner.clone())
    }

    /// Updates a NotebookRuntimeTemplate.
    pub fn update_notebook_runtime_template(
        &self,
    ) -> super::builder::notebook_service::UpdateNotebookRuntimeTemplate {
        super::builder::notebook_service::UpdateNotebookRuntimeTemplate::new(self.inner.clone())
    }

    /// Assigns a NotebookRuntime to a user for a particular Notebook file. This
    /// method will either returns an existing assignment or generates a new one.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn assign_notebook_runtime(
        &self,
    ) -> super::builder::notebook_service::AssignNotebookRuntime {
        super::builder::notebook_service::AssignNotebookRuntime::new(self.inner.clone())
    }

    /// Gets a NotebookRuntime.
    pub fn get_notebook_runtime(&self) -> super::builder::notebook_service::GetNotebookRuntime {
        super::builder::notebook_service::GetNotebookRuntime::new(self.inner.clone())
    }

    /// Lists NotebookRuntimes in a Location.
    pub fn list_notebook_runtimes(&self) -> super::builder::notebook_service::ListNotebookRuntimes {
        super::builder::notebook_service::ListNotebookRuntimes::new(self.inner.clone())
    }

    /// Deletes a NotebookRuntime.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_notebook_runtime(
        &self,
    ) -> super::builder::notebook_service::DeleteNotebookRuntime {
        super::builder::notebook_service::DeleteNotebookRuntime::new(self.inner.clone())
    }

    /// Upgrades a NotebookRuntime.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn upgrade_notebook_runtime(
        &self,
    ) -> super::builder::notebook_service::UpgradeNotebookRuntime {
        super::builder::notebook_service::UpgradeNotebookRuntime::new(self.inner.clone())
    }

    /// Starts a NotebookRuntime.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn start_notebook_runtime(&self) -> super::builder::notebook_service::StartNotebookRuntime {
        super::builder::notebook_service::StartNotebookRuntime::new(self.inner.clone())
    }

    /// Stops a NotebookRuntime.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn stop_notebook_runtime(&self) -> super::builder::notebook_service::StopNotebookRuntime {
        super::builder::notebook_service::StopNotebookRuntime::new(self.inner.clone())
    }

    /// Creates a NotebookExecutionJob.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_notebook_execution_job(
        &self,
    ) -> super::builder::notebook_service::CreateNotebookExecutionJob {
        super::builder::notebook_service::CreateNotebookExecutionJob::new(self.inner.clone())
    }

    /// Gets a NotebookExecutionJob.
    pub fn get_notebook_execution_job(
        &self,
    ) -> super::builder::notebook_service::GetNotebookExecutionJob {
        super::builder::notebook_service::GetNotebookExecutionJob::new(self.inner.clone())
    }

    /// Lists NotebookExecutionJobs in a Location.
    pub fn list_notebook_execution_jobs(
        &self,
    ) -> super::builder::notebook_service::ListNotebookExecutionJobs {
        super::builder::notebook_service::ListNotebookExecutionJobs::new(self.inner.clone())
    }

    /// Deletes a NotebookExecutionJob.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_notebook_execution_job(
        &self,
    ) -> super::builder::notebook_service::DeleteNotebookExecutionJob {
        super::builder::notebook_service::DeleteNotebookExecutionJob::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::notebook_service::ListLocations {
        super::builder::notebook_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::notebook_service::GetLocation {
        super::builder::notebook_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::notebook_service::SetIamPolicy {
        super::builder::notebook_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::notebook_service::GetIamPolicy {
        super::builder::notebook_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::notebook_service::TestIamPermissions {
        super::builder::notebook_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::notebook_service::ListOperations {
        super::builder::notebook_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::notebook_service::GetOperation {
        super::builder::notebook_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::notebook_service::DeleteOperation {
        super::builder::notebook_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::notebook_service::CancelOperation {
        super::builder::notebook_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::notebook_service::WaitOperation {
        super::builder::notebook_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
/// let client = PersistentResourceService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for managing Vertex AI's machine learning PersistentResource.
///
/// # Configuration
///
/// To configure `PersistentResourceService` use the `with_*` methods in the type returned
/// by [builder()][PersistentResourceService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::persistent_resource_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::persistent_resource_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `PersistentResourceService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `PersistentResourceService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "persistent-resource-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "persistent-resource-service")))]
#[derive(Clone, Debug)]
pub struct PersistentResourceService {
    inner: std::sync::Arc<dyn super::stub::dynamic::PersistentResourceService>,
}

#[cfg(feature = "persistent-resource-service")]
impl PersistentResourceService {
    /// Returns a builder for [PersistentResourceService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::PersistentResourceService;
    /// let client = PersistentResourceService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::persistent_resource_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::persistent_resource_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::PersistentResourceService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<
        std::sync::Arc<dyn super::stub::dynamic::PersistentResourceService>,
    > {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::PersistentResourceService> {
        super::transport::PersistentResourceService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::PersistentResourceService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::PersistentResourceService::new)
    }

    /// Creates a PersistentResource.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_persistent_resource(
        &self,
    ) -> super::builder::persistent_resource_service::CreatePersistentResource {
        super::builder::persistent_resource_service::CreatePersistentResource::new(
            self.inner.clone(),
        )
    }

    /// Gets a PersistentResource.
    pub fn get_persistent_resource(
        &self,
    ) -> super::builder::persistent_resource_service::GetPersistentResource {
        super::builder::persistent_resource_service::GetPersistentResource::new(self.inner.clone())
    }

    /// Lists PersistentResources in a Location.
    pub fn list_persistent_resources(
        &self,
    ) -> super::builder::persistent_resource_service::ListPersistentResources {
        super::builder::persistent_resource_service::ListPersistentResources::new(
            self.inner.clone(),
        )
    }

    /// Deletes a PersistentResource.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_persistent_resource(
        &self,
    ) -> super::builder::persistent_resource_service::DeletePersistentResource {
        super::builder::persistent_resource_service::DeletePersistentResource::new(
            self.inner.clone(),
        )
    }

    /// Updates a PersistentResource.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_persistent_resource(
        &self,
    ) -> super::builder::persistent_resource_service::UpdatePersistentResource {
        super::builder::persistent_resource_service::UpdatePersistentResource::new(
            self.inner.clone(),
        )
    }

    /// Reboots a PersistentResource.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn reboot_persistent_resource(
        &self,
    ) -> super::builder::persistent_resource_service::RebootPersistentResource {
        super::builder::persistent_resource_service::RebootPersistentResource::new(
            self.inner.clone(),
        )
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::persistent_resource_service::ListLocations {
        super::builder::persistent_resource_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::persistent_resource_service::GetLocation {
        super::builder::persistent_resource_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::persistent_resource_service::SetIamPolicy {
        super::builder::persistent_resource_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::persistent_resource_service::GetIamPolicy {
        super::builder::persistent_resource_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::persistent_resource_service::TestIamPermissions {
        super::builder::persistent_resource_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::persistent_resource_service::ListOperations {
        super::builder::persistent_resource_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::persistent_resource_service::GetOperation {
        super::builder::persistent_resource_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::persistent_resource_service::DeleteOperation {
        super::builder::persistent_resource_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::persistent_resource_service::CancelOperation {
        super::builder::persistent_resource_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::persistent_resource_service::WaitOperation {
        super::builder::persistent_resource_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::PipelineService;
/// let client = PipelineService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for creating and managing Vertex AI's pipelines. This includes both
/// `TrainingPipeline` resources (used for AutoML and custom training) and
/// `PipelineJob` resources (used for Vertex AI Pipelines).
///
/// # Configuration
///
/// To configure `PipelineService` use the `with_*` methods in the type returned
/// by [builder()][PipelineService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::pipeline_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::pipeline_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `PipelineService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `PipelineService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "pipeline-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "pipeline-service")))]
#[derive(Clone, Debug)]
pub struct PipelineService {
    inner: std::sync::Arc<dyn super::stub::dynamic::PipelineService>,
}

#[cfg(feature = "pipeline-service")]
impl PipelineService {
    /// Returns a builder for [PipelineService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::PipelineService;
    /// let client = PipelineService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::pipeline_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::pipeline_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::PipelineService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::PipelineService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::PipelineService> {
        super::transport::PipelineService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::PipelineService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::PipelineService::new)
    }

    /// Creates a TrainingPipeline. A created TrainingPipeline right away will be
    /// attempted to be run.
    pub fn create_training_pipeline(
        &self,
    ) -> super::builder::pipeline_service::CreateTrainingPipeline {
        super::builder::pipeline_service::CreateTrainingPipeline::new(self.inner.clone())
    }

    /// Gets a TrainingPipeline.
    pub fn get_training_pipeline(&self) -> super::builder::pipeline_service::GetTrainingPipeline {
        super::builder::pipeline_service::GetTrainingPipeline::new(self.inner.clone())
    }

    /// Lists TrainingPipelines in a Location.
    pub fn list_training_pipelines(
        &self,
    ) -> super::builder::pipeline_service::ListTrainingPipelines {
        super::builder::pipeline_service::ListTrainingPipelines::new(self.inner.clone())
    }

    /// Deletes a TrainingPipeline.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_training_pipeline(
        &self,
    ) -> super::builder::pipeline_service::DeleteTrainingPipeline {
        super::builder::pipeline_service::DeleteTrainingPipeline::new(self.inner.clone())
    }

    /// Cancels a TrainingPipeline.
    /// Starts asynchronous cancellation on the TrainingPipeline. The server
    /// makes a best effort to cancel the pipeline, but success is not
    /// guaranteed. Clients can use
    /// [PipelineService.GetTrainingPipeline][google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline]
    /// or other methods to check whether the cancellation succeeded or whether the
    /// pipeline completed despite cancellation. On successful cancellation,
    /// the TrainingPipeline is not deleted; instead it becomes a pipeline with
    /// a
    /// [TrainingPipeline.error][google.cloud.aiplatform.v1.TrainingPipeline.error]
    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
    /// corresponding to `Code.CANCELLED`, and
    /// [TrainingPipeline.state][google.cloud.aiplatform.v1.TrainingPipeline.state]
    /// is set to `CANCELLED`.
    ///
    /// [google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline]: crate::client::PipelineService::get_training_pipeline
    /// [google.cloud.aiplatform.v1.TrainingPipeline.error]: crate::model::TrainingPipeline::error
    /// [google.cloud.aiplatform.v1.TrainingPipeline.state]: crate::model::TrainingPipeline::state
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub fn cancel_training_pipeline(
        &self,
    ) -> super::builder::pipeline_service::CancelTrainingPipeline {
        super::builder::pipeline_service::CancelTrainingPipeline::new(self.inner.clone())
    }

    /// Creates a PipelineJob. A PipelineJob will run immediately when created.
    pub fn create_pipeline_job(&self) -> super::builder::pipeline_service::CreatePipelineJob {
        super::builder::pipeline_service::CreatePipelineJob::new(self.inner.clone())
    }

    /// Gets a PipelineJob.
    pub fn get_pipeline_job(&self) -> super::builder::pipeline_service::GetPipelineJob {
        super::builder::pipeline_service::GetPipelineJob::new(self.inner.clone())
    }

    /// Lists PipelineJobs in a Location.
    pub fn list_pipeline_jobs(&self) -> super::builder::pipeline_service::ListPipelineJobs {
        super::builder::pipeline_service::ListPipelineJobs::new(self.inner.clone())
    }

    /// Deletes a PipelineJob.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_pipeline_job(&self) -> super::builder::pipeline_service::DeletePipelineJob {
        super::builder::pipeline_service::DeletePipelineJob::new(self.inner.clone())
    }

    /// Batch deletes PipelineJobs
    /// The Operation is atomic. If it fails, none of the PipelineJobs are deleted.
    /// If it succeeds, all of the PipelineJobs are deleted.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_delete_pipeline_jobs(
        &self,
    ) -> super::builder::pipeline_service::BatchDeletePipelineJobs {
        super::builder::pipeline_service::BatchDeletePipelineJobs::new(self.inner.clone())
    }

    /// Cancels a PipelineJob.
    /// Starts asynchronous cancellation on the PipelineJob. The server
    /// makes a best effort to cancel the pipeline, but success is not
    /// guaranteed. Clients can use
    /// [PipelineService.GetPipelineJob][google.cloud.aiplatform.v1.PipelineService.GetPipelineJob]
    /// or other methods to check whether the cancellation succeeded or whether the
    /// pipeline completed despite cancellation. On successful cancellation,
    /// the PipelineJob is not deleted; instead it becomes a pipeline with
    /// a [PipelineJob.error][google.cloud.aiplatform.v1.PipelineJob.error] value
    /// with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding
    /// to `Code.CANCELLED`, and
    /// [PipelineJob.state][google.cloud.aiplatform.v1.PipelineJob.state] is set to
    /// `CANCELLED`.
    ///
    /// [google.cloud.aiplatform.v1.PipelineJob.error]: crate::model::PipelineJob::error
    /// [google.cloud.aiplatform.v1.PipelineJob.state]: crate::model::PipelineJob::state
    /// [google.cloud.aiplatform.v1.PipelineService.GetPipelineJob]: crate::client::PipelineService::get_pipeline_job
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub fn cancel_pipeline_job(&self) -> super::builder::pipeline_service::CancelPipelineJob {
        super::builder::pipeline_service::CancelPipelineJob::new(self.inner.clone())
    }

    /// Batch cancel PipelineJobs.
    /// Firstly the server will check if all the jobs are in non-terminal states,
    /// and skip the jobs that are already terminated.
    /// If the operation failed, none of the pipeline jobs are cancelled.
    /// The server will poll the states of all the pipeline jobs periodically
    /// to check the cancellation status.
    /// This operation will return an LRO.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_cancel_pipeline_jobs(
        &self,
    ) -> super::builder::pipeline_service::BatchCancelPipelineJobs {
        super::builder::pipeline_service::BatchCancelPipelineJobs::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::pipeline_service::ListLocations {
        super::builder::pipeline_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::pipeline_service::GetLocation {
        super::builder::pipeline_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::pipeline_service::SetIamPolicy {
        super::builder::pipeline_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::pipeline_service::GetIamPolicy {
        super::builder::pipeline_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::pipeline_service::TestIamPermissions {
        super::builder::pipeline_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::pipeline_service::ListOperations {
        super::builder::pipeline_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::pipeline_service::GetOperation {
        super::builder::pipeline_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::pipeline_service::DeleteOperation {
        super::builder::pipeline_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::pipeline_service::CancelOperation {
        super::builder::pipeline_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::pipeline_service::WaitOperation {
        super::builder::pipeline_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::PredictionService;
/// let client = PredictionService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for online predictions and explanations.
///
/// # Configuration
///
/// To configure `PredictionService` use the `with_*` methods in the type returned
/// by [builder()][PredictionService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::prediction_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::prediction_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `PredictionService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `PredictionService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "prediction-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "prediction-service")))]
#[derive(Clone, Debug)]
pub struct PredictionService {
    inner: std::sync::Arc<dyn super::stub::dynamic::PredictionService>,
}

#[cfg(feature = "prediction-service")]
impl PredictionService {
    /// Returns a builder for [PredictionService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::PredictionService;
    /// let client = PredictionService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::prediction_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::prediction_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::PredictionService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::PredictionService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::PredictionService> {
        super::transport::PredictionService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::PredictionService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::PredictionService::new)
    }

    /// Perform an online prediction.
    pub fn predict(&self) -> super::builder::prediction_service::Predict {
        super::builder::prediction_service::Predict::new(self.inner.clone())
    }

    /// Perform an online prediction with an arbitrary HTTP payload.
    ///
    /// The response includes the following HTTP headers:
    ///
    /// * `X-Vertex-AI-Endpoint-Id`: ID of the
    ///   [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this
    ///   prediction.
    ///
    /// * `X-Vertex-AI-Deployed-Model-Id`: ID of the Endpoint's
    ///   [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this
    ///   prediction.
    ///
    ///
    /// [google.cloud.aiplatform.v1.DeployedModel]: crate::model::DeployedModel
    /// [google.cloud.aiplatform.v1.Endpoint]: crate::model::Endpoint
    pub fn raw_predict(&self) -> super::builder::prediction_service::RawPredict {
        super::builder::prediction_service::RawPredict::new(self.inner.clone())
    }

    /// Perform an unary online prediction request to a gRPC model server for
    /// Vertex first-party products and frameworks.
    pub fn direct_predict(&self) -> super::builder::prediction_service::DirectPredict {
        super::builder::prediction_service::DirectPredict::new(self.inner.clone())
    }

    /// Perform an unary online prediction request to a gRPC model server for
    /// custom containers.
    pub fn direct_raw_predict(&self) -> super::builder::prediction_service::DirectRawPredict {
        super::builder::prediction_service::DirectRawPredict::new(self.inner.clone())
    }

    /// Perform an online explanation.
    ///
    /// If
    /// [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]
    /// is specified, the corresponding DeployModel must have
    /// [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
    /// populated. If
    /// [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]
    /// is not specified, all DeployedModels must have
    /// [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
    /// populated.
    ///
    /// [google.cloud.aiplatform.v1.DeployedModel.explanation_spec]: crate::model::DeployedModel::explanation_spec
    /// [google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id]: crate::model::ExplainRequest::deployed_model_id
    pub fn explain(&self) -> super::builder::prediction_service::Explain {
        super::builder::prediction_service::Explain::new(self.inner.clone())
    }

    /// Generate content with multimodal inputs.
    pub fn generate_content(&self) -> super::builder::prediction_service::GenerateContent {
        super::builder::prediction_service::GenerateContent::new(self.inner.clone())
    }

    /// Embed content with multimodal inputs.
    pub fn embed_content(&self) -> super::builder::prediction_service::EmbedContent {
        super::builder::prediction_service::EmbedContent::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::prediction_service::ListLocations {
        super::builder::prediction_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::prediction_service::GetLocation {
        super::builder::prediction_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::prediction_service::SetIamPolicy {
        super::builder::prediction_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::prediction_service::GetIamPolicy {
        super::builder::prediction_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::prediction_service::TestIamPermissions {
        super::builder::prediction_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::prediction_service::ListOperations {
        super::builder::prediction_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::prediction_service::GetOperation {
        super::builder::prediction_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::prediction_service::DeleteOperation {
        super::builder::prediction_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::prediction_service::CancelOperation {
        super::builder::prediction_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::prediction_service::WaitOperation {
        super::builder::prediction_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
/// let client = ReasoningEngineExecutionService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for executing queries on Reasoning Engine.
///
/// # Configuration
///
/// To configure `ReasoningEngineExecutionService` use the `with_*` methods in the type returned
/// by [builder()][ReasoningEngineExecutionService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::reasoning_engine_execution_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::reasoning_engine_execution_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `ReasoningEngineExecutionService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `ReasoningEngineExecutionService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "reasoning-engine-execution-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-execution-service")))]
#[derive(Clone, Debug)]
pub struct ReasoningEngineExecutionService {
    inner: std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineExecutionService>,
}

#[cfg(feature = "reasoning-engine-execution-service")]
impl ReasoningEngineExecutionService {
    /// Returns a builder for [ReasoningEngineExecutionService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService;
    /// let client = ReasoningEngineExecutionService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::reasoning_engine_execution_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::reasoning_engine_execution_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::ReasoningEngineExecutionService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<
        std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineExecutionService>,
    > {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ReasoningEngineExecutionService> {
        super::transport::ReasoningEngineExecutionService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ReasoningEngineExecutionService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::ReasoningEngineExecutionService::new)
    }

    /// Queries using a reasoning engine.
    pub fn query_reasoning_engine(
        &self,
    ) -> super::builder::reasoning_engine_execution_service::QueryReasoningEngine {
        super::builder::reasoning_engine_execution_service::QueryReasoningEngine::new(
            self.inner.clone(),
        )
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(
        &self,
    ) -> super::builder::reasoning_engine_execution_service::ListLocations {
        super::builder::reasoning_engine_execution_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::reasoning_engine_execution_service::GetLocation {
        super::builder::reasoning_engine_execution_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(
        &self,
    ) -> super::builder::reasoning_engine_execution_service::SetIamPolicy {
        super::builder::reasoning_engine_execution_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(
        &self,
    ) -> super::builder::reasoning_engine_execution_service::GetIamPolicy {
        super::builder::reasoning_engine_execution_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::reasoning_engine_execution_service::TestIamPermissions {
        super::builder::reasoning_engine_execution_service::TestIamPermissions::new(
            self.inner.clone(),
        )
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(
        &self,
    ) -> super::builder::reasoning_engine_execution_service::ListOperations {
        super::builder::reasoning_engine_execution_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(
        &self,
    ) -> super::builder::reasoning_engine_execution_service::GetOperation {
        super::builder::reasoning_engine_execution_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(
        &self,
    ) -> super::builder::reasoning_engine_execution_service::DeleteOperation {
        super::builder::reasoning_engine_execution_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(
        &self,
    ) -> super::builder::reasoning_engine_execution_service::CancelOperation {
        super::builder::reasoning_engine_execution_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(
        &self,
    ) -> super::builder::reasoning_engine_execution_service::WaitOperation {
        super::builder::reasoning_engine_execution_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
/// let client = ReasoningEngineService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for managing Vertex AI's Reasoning Engines.
///
/// # Configuration
///
/// To configure `ReasoningEngineService` use the `with_*` methods in the type returned
/// by [builder()][ReasoningEngineService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::reasoning_engine_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::reasoning_engine_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `ReasoningEngineService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `ReasoningEngineService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "reasoning-engine-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-service")))]
#[derive(Clone, Debug)]
pub struct ReasoningEngineService {
    inner: std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineService>,
}

#[cfg(feature = "reasoning-engine-service")]
impl ReasoningEngineService {
    /// Returns a builder for [ReasoningEngineService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::ReasoningEngineService;
    /// let client = ReasoningEngineService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::reasoning_engine_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::reasoning_engine_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::ReasoningEngineService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ReasoningEngineService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ReasoningEngineService> {
        super::transport::ReasoningEngineService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ReasoningEngineService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::ReasoningEngineService::new)
    }

    /// Creates a reasoning engine.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_reasoning_engine(
        &self,
    ) -> super::builder::reasoning_engine_service::CreateReasoningEngine {
        super::builder::reasoning_engine_service::CreateReasoningEngine::new(self.inner.clone())
    }

    /// Gets a reasoning engine.
    pub fn get_reasoning_engine(
        &self,
    ) -> super::builder::reasoning_engine_service::GetReasoningEngine {
        super::builder::reasoning_engine_service::GetReasoningEngine::new(self.inner.clone())
    }

    /// Lists reasoning engines in a location.
    pub fn list_reasoning_engines(
        &self,
    ) -> super::builder::reasoning_engine_service::ListReasoningEngines {
        super::builder::reasoning_engine_service::ListReasoningEngines::new(self.inner.clone())
    }

    /// Updates a reasoning engine.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_reasoning_engine(
        &self,
    ) -> super::builder::reasoning_engine_service::UpdateReasoningEngine {
        super::builder::reasoning_engine_service::UpdateReasoningEngine::new(self.inner.clone())
    }

    /// Deletes a reasoning engine.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_reasoning_engine(
        &self,
    ) -> super::builder::reasoning_engine_service::DeleteReasoningEngine {
        super::builder::reasoning_engine_service::DeleteReasoningEngine::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::reasoning_engine_service::ListLocations {
        super::builder::reasoning_engine_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::reasoning_engine_service::GetLocation {
        super::builder::reasoning_engine_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::reasoning_engine_service::SetIamPolicy {
        super::builder::reasoning_engine_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::reasoning_engine_service::GetIamPolicy {
        super::builder::reasoning_engine_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::reasoning_engine_service::TestIamPermissions {
        super::builder::reasoning_engine_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::reasoning_engine_service::ListOperations {
        super::builder::reasoning_engine_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::reasoning_engine_service::GetOperation {
        super::builder::reasoning_engine_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::reasoning_engine_service::DeleteOperation {
        super::builder::reasoning_engine_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::reasoning_engine_service::CancelOperation {
        super::builder::reasoning_engine_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::reasoning_engine_service::WaitOperation {
        super::builder::reasoning_engine_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::ScheduleService;
/// let client = ScheduleService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for creating and managing Vertex AI's Schedule resources to
/// periodically launch shceudled runs to make API calls.
///
/// # Configuration
///
/// To configure `ScheduleService` use the `with_*` methods in the type returned
/// by [builder()][ScheduleService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::schedule_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::schedule_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `ScheduleService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `ScheduleService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "schedule-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "schedule-service")))]
#[derive(Clone, Debug)]
pub struct ScheduleService {
    inner: std::sync::Arc<dyn super::stub::dynamic::ScheduleService>,
}

#[cfg(feature = "schedule-service")]
impl ScheduleService {
    /// Returns a builder for [ScheduleService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::ScheduleService;
    /// let client = ScheduleService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::schedule_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::schedule_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::ScheduleService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ScheduleService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ScheduleService> {
        super::transport::ScheduleService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::ScheduleService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::ScheduleService::new)
    }

    /// Creates a Schedule.
    pub fn create_schedule(&self) -> super::builder::schedule_service::CreateSchedule {
        super::builder::schedule_service::CreateSchedule::new(self.inner.clone())
    }

    /// Deletes a Schedule.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_schedule(&self) -> super::builder::schedule_service::DeleteSchedule {
        super::builder::schedule_service::DeleteSchedule::new(self.inner.clone())
    }

    /// Gets a Schedule.
    pub fn get_schedule(&self) -> super::builder::schedule_service::GetSchedule {
        super::builder::schedule_service::GetSchedule::new(self.inner.clone())
    }

    /// Lists Schedules in a Location.
    pub fn list_schedules(&self) -> super::builder::schedule_service::ListSchedules {
        super::builder::schedule_service::ListSchedules::new(self.inner.clone())
    }

    /// Pauses a Schedule. Will mark
    /// [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'PAUSED'. If
    /// the schedule is paused, no new runs will be created. Already created runs
    /// will NOT be paused or canceled.
    ///
    /// [google.cloud.aiplatform.v1.Schedule.state]: crate::model::Schedule::state
    pub fn pause_schedule(&self) -> super::builder::schedule_service::PauseSchedule {
        super::builder::schedule_service::PauseSchedule::new(self.inner.clone())
    }

    /// Resumes a paused Schedule to start scheduling new runs. Will mark
    /// [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to 'ACTIVE'.
    /// Only paused Schedule can be resumed.
    ///
    /// When the Schedule is resumed, new runs will be scheduled starting from the
    /// next execution time after the current time based on the time_specification
    /// in the Schedule. If
    /// [Schedule.catch_up][google.cloud.aiplatform.v1.Schedule.catch_up] is set up
    /// true, all missed runs will be scheduled for backfill first.
    ///
    /// [google.cloud.aiplatform.v1.Schedule.catch_up]: crate::model::Schedule::catch_up
    /// [google.cloud.aiplatform.v1.Schedule.state]: crate::model::Schedule::state
    pub fn resume_schedule(&self) -> super::builder::schedule_service::ResumeSchedule {
        super::builder::schedule_service::ResumeSchedule::new(self.inner.clone())
    }

    /// Updates an active or paused Schedule.
    ///
    /// When the Schedule is updated, new runs will be scheduled starting from the
    /// updated next execution time after the update time based on the
    /// time_specification in the updated Schedule. All unstarted runs before the
    /// update time will be skipped while already created runs will NOT be paused
    /// or canceled.
    pub fn update_schedule(&self) -> super::builder::schedule_service::UpdateSchedule {
        super::builder::schedule_service::UpdateSchedule::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::schedule_service::ListLocations {
        super::builder::schedule_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::schedule_service::GetLocation {
        super::builder::schedule_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::schedule_service::SetIamPolicy {
        super::builder::schedule_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::schedule_service::GetIamPolicy {
        super::builder::schedule_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::schedule_service::TestIamPermissions {
        super::builder::schedule_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::schedule_service::ListOperations {
        super::builder::schedule_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::schedule_service::GetOperation {
        super::builder::schedule_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::schedule_service::DeleteOperation {
        super::builder::schedule_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::schedule_service::CancelOperation {
        super::builder::schedule_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::schedule_service::WaitOperation {
        super::builder::schedule_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
/// let client = SpecialistPoolService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for creating and managing Customer SpecialistPools.
/// When customers start Data Labeling jobs, they can reuse/create Specialist
/// Pools to bring their own Specialists to label the data.
/// Customers can add/remove Managers for the Specialist Pool on Cloud console,
/// then Managers will get email notifications to manage Specialists and tasks on
/// CrowdCompute console.
///
/// # Configuration
///
/// To configure `SpecialistPoolService` use the `with_*` methods in the type returned
/// by [builder()][SpecialistPoolService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::specialist_pool_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::specialist_pool_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `SpecialistPoolService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `SpecialistPoolService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "specialist-pool-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "specialist-pool-service")))]
#[derive(Clone, Debug)]
pub struct SpecialistPoolService {
    inner: std::sync::Arc<dyn super::stub::dynamic::SpecialistPoolService>,
}

#[cfg(feature = "specialist-pool-service")]
impl SpecialistPoolService {
    /// Returns a builder for [SpecialistPoolService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::SpecialistPoolService;
    /// let client = SpecialistPoolService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::specialist_pool_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::specialist_pool_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::SpecialistPoolService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SpecialistPoolService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::SpecialistPoolService> {
        super::transport::SpecialistPoolService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::SpecialistPoolService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::SpecialistPoolService::new)
    }

    /// Creates a SpecialistPool.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_specialist_pool(
        &self,
    ) -> super::builder::specialist_pool_service::CreateSpecialistPool {
        super::builder::specialist_pool_service::CreateSpecialistPool::new(self.inner.clone())
    }

    /// Gets a SpecialistPool.
    pub fn get_specialist_pool(
        &self,
    ) -> super::builder::specialist_pool_service::GetSpecialistPool {
        super::builder::specialist_pool_service::GetSpecialistPool::new(self.inner.clone())
    }

    /// Lists SpecialistPools in a Location.
    pub fn list_specialist_pools(
        &self,
    ) -> super::builder::specialist_pool_service::ListSpecialistPools {
        super::builder::specialist_pool_service::ListSpecialistPools::new(self.inner.clone())
    }

    /// Deletes a SpecialistPool as well as all Specialists in the pool.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_specialist_pool(
        &self,
    ) -> super::builder::specialist_pool_service::DeleteSpecialistPool {
        super::builder::specialist_pool_service::DeleteSpecialistPool::new(self.inner.clone())
    }

    /// Updates a SpecialistPool.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_specialist_pool(
        &self,
    ) -> super::builder::specialist_pool_service::UpdateSpecialistPool {
        super::builder::specialist_pool_service::UpdateSpecialistPool::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::specialist_pool_service::ListLocations {
        super::builder::specialist_pool_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::specialist_pool_service::GetLocation {
        super::builder::specialist_pool_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::specialist_pool_service::SetIamPolicy {
        super::builder::specialist_pool_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::specialist_pool_service::GetIamPolicy {
        super::builder::specialist_pool_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::specialist_pool_service::TestIamPermissions {
        super::builder::specialist_pool_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::specialist_pool_service::ListOperations {
        super::builder::specialist_pool_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::specialist_pool_service::GetOperation {
        super::builder::specialist_pool_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::specialist_pool_service::DeleteOperation {
        super::builder::specialist_pool_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::specialist_pool_service::CancelOperation {
        super::builder::specialist_pool_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::specialist_pool_service::WaitOperation {
        super::builder::specialist_pool_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::TensorboardService;
/// let client = TensorboardService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// TensorboardService
///
/// # Configuration
///
/// To configure `TensorboardService` use the `with_*` methods in the type returned
/// by [builder()][TensorboardService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::tensorboard_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::tensorboard_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `TensorboardService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `TensorboardService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "tensorboard-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "tensorboard-service")))]
#[derive(Clone, Debug)]
pub struct TensorboardService {
    inner: std::sync::Arc<dyn super::stub::dynamic::TensorboardService>,
}

#[cfg(feature = "tensorboard-service")]
impl TensorboardService {
    /// Returns a builder for [TensorboardService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::TensorboardService;
    /// let client = TensorboardService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::tensorboard_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::tensorboard_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::TensorboardService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TensorboardService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::TensorboardService> {
        super::transport::TensorboardService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::TensorboardService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::TensorboardService::new)
    }

    /// Creates a Tensorboard.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_tensorboard(&self) -> super::builder::tensorboard_service::CreateTensorboard {
        super::builder::tensorboard_service::CreateTensorboard::new(self.inner.clone())
    }

    /// Gets a Tensorboard.
    pub fn get_tensorboard(&self) -> super::builder::tensorboard_service::GetTensorboard {
        super::builder::tensorboard_service::GetTensorboard::new(self.inner.clone())
    }

    /// Updates a Tensorboard.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_tensorboard(&self) -> super::builder::tensorboard_service::UpdateTensorboard {
        super::builder::tensorboard_service::UpdateTensorboard::new(self.inner.clone())
    }

    /// Lists Tensorboards in a Location.
    pub fn list_tensorboards(&self) -> super::builder::tensorboard_service::ListTensorboards {
        super::builder::tensorboard_service::ListTensorboards::new(self.inner.clone())
    }

    /// Deletes a Tensorboard.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_tensorboard(&self) -> super::builder::tensorboard_service::DeleteTensorboard {
        super::builder::tensorboard_service::DeleteTensorboard::new(self.inner.clone())
    }

    /// Returns a list of monthly active users for a given TensorBoard instance.
    pub fn read_tensorboard_usage(
        &self,
    ) -> super::builder::tensorboard_service::ReadTensorboardUsage {
        super::builder::tensorboard_service::ReadTensorboardUsage::new(self.inner.clone())
    }

    /// Returns the storage size for a given TensorBoard instance.
    pub fn read_tensorboard_size(
        &self,
    ) -> super::builder::tensorboard_service::ReadTensorboardSize {
        super::builder::tensorboard_service::ReadTensorboardSize::new(self.inner.clone())
    }

    /// Creates a TensorboardExperiment.
    pub fn create_tensorboard_experiment(
        &self,
    ) -> super::builder::tensorboard_service::CreateTensorboardExperiment {
        super::builder::tensorboard_service::CreateTensorboardExperiment::new(self.inner.clone())
    }

    /// Gets a TensorboardExperiment.
    pub fn get_tensorboard_experiment(
        &self,
    ) -> super::builder::tensorboard_service::GetTensorboardExperiment {
        super::builder::tensorboard_service::GetTensorboardExperiment::new(self.inner.clone())
    }

    /// Updates a TensorboardExperiment.
    pub fn update_tensorboard_experiment(
        &self,
    ) -> super::builder::tensorboard_service::UpdateTensorboardExperiment {
        super::builder::tensorboard_service::UpdateTensorboardExperiment::new(self.inner.clone())
    }

    /// Lists TensorboardExperiments in a Location.
    pub fn list_tensorboard_experiments(
        &self,
    ) -> super::builder::tensorboard_service::ListTensorboardExperiments {
        super::builder::tensorboard_service::ListTensorboardExperiments::new(self.inner.clone())
    }

    /// Deletes a TensorboardExperiment.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_tensorboard_experiment(
        &self,
    ) -> super::builder::tensorboard_service::DeleteTensorboardExperiment {
        super::builder::tensorboard_service::DeleteTensorboardExperiment::new(self.inner.clone())
    }

    /// Creates a TensorboardRun.
    pub fn create_tensorboard_run(
        &self,
    ) -> super::builder::tensorboard_service::CreateTensorboardRun {
        super::builder::tensorboard_service::CreateTensorboardRun::new(self.inner.clone())
    }

    /// Batch create TensorboardRuns.
    pub fn batch_create_tensorboard_runs(
        &self,
    ) -> super::builder::tensorboard_service::BatchCreateTensorboardRuns {
        super::builder::tensorboard_service::BatchCreateTensorboardRuns::new(self.inner.clone())
    }

    /// Gets a TensorboardRun.
    pub fn get_tensorboard_run(&self) -> super::builder::tensorboard_service::GetTensorboardRun {
        super::builder::tensorboard_service::GetTensorboardRun::new(self.inner.clone())
    }

    /// Updates a TensorboardRun.
    pub fn update_tensorboard_run(
        &self,
    ) -> super::builder::tensorboard_service::UpdateTensorboardRun {
        super::builder::tensorboard_service::UpdateTensorboardRun::new(self.inner.clone())
    }

    /// Lists TensorboardRuns in a Location.
    pub fn list_tensorboard_runs(
        &self,
    ) -> super::builder::tensorboard_service::ListTensorboardRuns {
        super::builder::tensorboard_service::ListTensorboardRuns::new(self.inner.clone())
    }

    /// Deletes a TensorboardRun.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_tensorboard_run(
        &self,
    ) -> super::builder::tensorboard_service::DeleteTensorboardRun {
        super::builder::tensorboard_service::DeleteTensorboardRun::new(self.inner.clone())
    }

    /// Batch create TensorboardTimeSeries that belong to a TensorboardExperiment.
    pub fn batch_create_tensorboard_time_series(
        &self,
    ) -> super::builder::tensorboard_service::BatchCreateTensorboardTimeSeries {
        super::builder::tensorboard_service::BatchCreateTensorboardTimeSeries::new(
            self.inner.clone(),
        )
    }

    /// Creates a TensorboardTimeSeries.
    pub fn create_tensorboard_time_series(
        &self,
    ) -> super::builder::tensorboard_service::CreateTensorboardTimeSeries {
        super::builder::tensorboard_service::CreateTensorboardTimeSeries::new(self.inner.clone())
    }

    /// Gets a TensorboardTimeSeries.
    pub fn get_tensorboard_time_series(
        &self,
    ) -> super::builder::tensorboard_service::GetTensorboardTimeSeries {
        super::builder::tensorboard_service::GetTensorboardTimeSeries::new(self.inner.clone())
    }

    /// Updates a TensorboardTimeSeries.
    pub fn update_tensorboard_time_series(
        &self,
    ) -> super::builder::tensorboard_service::UpdateTensorboardTimeSeries {
        super::builder::tensorboard_service::UpdateTensorboardTimeSeries::new(self.inner.clone())
    }

    /// Lists TensorboardTimeSeries in a Location.
    pub fn list_tensorboard_time_series(
        &self,
    ) -> super::builder::tensorboard_service::ListTensorboardTimeSeries {
        super::builder::tensorboard_service::ListTensorboardTimeSeries::new(self.inner.clone())
    }

    /// Deletes a TensorboardTimeSeries.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_tensorboard_time_series(
        &self,
    ) -> super::builder::tensorboard_service::DeleteTensorboardTimeSeries {
        super::builder::tensorboard_service::DeleteTensorboardTimeSeries::new(self.inner.clone())
    }

    /// Reads multiple TensorboardTimeSeries' data. The data point number limit is
    /// 1000 for scalars, 100 for tensors and blob references. If the number of
    /// data points stored is less than the limit, all data is returned.
    /// Otherwise, the number limit of data points is randomly selected from
    /// this time series and returned.
    pub fn batch_read_tensorboard_time_series_data(
        &self,
    ) -> super::builder::tensorboard_service::BatchReadTensorboardTimeSeriesData {
        super::builder::tensorboard_service::BatchReadTensorboardTimeSeriesData::new(
            self.inner.clone(),
        )
    }

    /// Reads a TensorboardTimeSeries' data. By default, if the number of data
    /// points stored is less than 1000, all data is returned. Otherwise, 1000
    /// data points is randomly selected from this time series and returned.
    /// This value can be changed by changing max_data_points, which can't be
    /// greater than 10k.
    pub fn read_tensorboard_time_series_data(
        &self,
    ) -> super::builder::tensorboard_service::ReadTensorboardTimeSeriesData {
        super::builder::tensorboard_service::ReadTensorboardTimeSeriesData::new(self.inner.clone())
    }

    /// Write time series data points of multiple TensorboardTimeSeries in multiple
    /// TensorboardRun's. If any data fail to be ingested, an error is returned.
    pub fn write_tensorboard_experiment_data(
        &self,
    ) -> super::builder::tensorboard_service::WriteTensorboardExperimentData {
        super::builder::tensorboard_service::WriteTensorboardExperimentData::new(self.inner.clone())
    }

    /// Write time series data points into multiple TensorboardTimeSeries under
    /// a TensorboardRun. If any data fail to be ingested, an error is returned.
    pub fn write_tensorboard_run_data(
        &self,
    ) -> super::builder::tensorboard_service::WriteTensorboardRunData {
        super::builder::tensorboard_service::WriteTensorboardRunData::new(self.inner.clone())
    }

    /// Exports a TensorboardTimeSeries' data. Data is returned in paginated
    /// responses.
    pub fn export_tensorboard_time_series_data(
        &self,
    ) -> super::builder::tensorboard_service::ExportTensorboardTimeSeriesData {
        super::builder::tensorboard_service::ExportTensorboardTimeSeriesData::new(
            self.inner.clone(),
        )
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::tensorboard_service::ListLocations {
        super::builder::tensorboard_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::tensorboard_service::GetLocation {
        super::builder::tensorboard_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::tensorboard_service::SetIamPolicy {
        super::builder::tensorboard_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::tensorboard_service::GetIamPolicy {
        super::builder::tensorboard_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::tensorboard_service::TestIamPermissions {
        super::builder::tensorboard_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::tensorboard_service::ListOperations {
        super::builder::tensorboard_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::tensorboard_service::GetOperation {
        super::builder::tensorboard_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::tensorboard_service::DeleteOperation {
        super::builder::tensorboard_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::tensorboard_service::CancelOperation {
        super::builder::tensorboard_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::tensorboard_service::WaitOperation {
        super::builder::tensorboard_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
/// let client = VertexRagDataService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for managing user data for RAG.
///
/// # Configuration
///
/// To configure `VertexRagDataService` use the `with_*` methods in the type returned
/// by [builder()][VertexRagDataService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::vertex_rag_data_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::vertex_rag_data_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `VertexRagDataService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `VertexRagDataService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "vertex-rag-data-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-data-service")))]
#[derive(Clone, Debug)]
pub struct VertexRagDataService {
    inner: std::sync::Arc<dyn super::stub::dynamic::VertexRagDataService>,
}

#[cfg(feature = "vertex-rag-data-service")]
impl VertexRagDataService {
    /// Returns a builder for [VertexRagDataService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::VertexRagDataService;
    /// let client = VertexRagDataService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::vertex_rag_data_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::vertex_rag_data_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::VertexRagDataService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::VertexRagDataService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::VertexRagDataService> {
        super::transport::VertexRagDataService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::VertexRagDataService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::VertexRagDataService::new)
    }

    /// Creates a RagCorpus.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_rag_corpus(&self) -> super::builder::vertex_rag_data_service::CreateRagCorpus {
        super::builder::vertex_rag_data_service::CreateRagCorpus::new(self.inner.clone())
    }

    /// Updates a RagCorpus.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_rag_corpus(&self) -> super::builder::vertex_rag_data_service::UpdateRagCorpus {
        super::builder::vertex_rag_data_service::UpdateRagCorpus::new(self.inner.clone())
    }

    /// Gets a RagCorpus.
    pub fn get_rag_corpus(&self) -> super::builder::vertex_rag_data_service::GetRagCorpus {
        super::builder::vertex_rag_data_service::GetRagCorpus::new(self.inner.clone())
    }

    /// Lists RagCorpora in a Location.
    pub fn list_rag_corpora(&self) -> super::builder::vertex_rag_data_service::ListRagCorpora {
        super::builder::vertex_rag_data_service::ListRagCorpora::new(self.inner.clone())
    }

    /// Deletes a RagCorpus.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_rag_corpus(&self) -> super::builder::vertex_rag_data_service::DeleteRagCorpus {
        super::builder::vertex_rag_data_service::DeleteRagCorpus::new(self.inner.clone())
    }

    /// Upload a file into a RagCorpus.
    pub fn upload_rag_file(&self) -> super::builder::vertex_rag_data_service::UploadRagFile {
        super::builder::vertex_rag_data_service::UploadRagFile::new(self.inner.clone())
    }

    /// Import files from Google Cloud Storage or Google Drive into a RagCorpus.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn import_rag_files(&self) -> super::builder::vertex_rag_data_service::ImportRagFiles {
        super::builder::vertex_rag_data_service::ImportRagFiles::new(self.inner.clone())
    }

    /// Gets a RagFile.
    pub fn get_rag_file(&self) -> super::builder::vertex_rag_data_service::GetRagFile {
        super::builder::vertex_rag_data_service::GetRagFile::new(self.inner.clone())
    }

    /// Lists RagFiles in a RagCorpus.
    pub fn list_rag_files(&self) -> super::builder::vertex_rag_data_service::ListRagFiles {
        super::builder::vertex_rag_data_service::ListRagFiles::new(self.inner.clone())
    }

    /// Deletes a RagFile.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_rag_file(&self) -> super::builder::vertex_rag_data_service::DeleteRagFile {
        super::builder::vertex_rag_data_service::DeleteRagFile::new(self.inner.clone())
    }

    /// Updates a RagEngineConfig.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_rag_engine_config(
        &self,
    ) -> super::builder::vertex_rag_data_service::UpdateRagEngineConfig {
        super::builder::vertex_rag_data_service::UpdateRagEngineConfig::new(self.inner.clone())
    }

    /// Gets a RagEngineConfig.
    pub fn get_rag_engine_config(
        &self,
    ) -> super::builder::vertex_rag_data_service::GetRagEngineConfig {
        super::builder::vertex_rag_data_service::GetRagEngineConfig::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::vertex_rag_data_service::ListLocations {
        super::builder::vertex_rag_data_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::vertex_rag_data_service::GetLocation {
        super::builder::vertex_rag_data_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::vertex_rag_data_service::SetIamPolicy {
        super::builder::vertex_rag_data_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::vertex_rag_data_service::GetIamPolicy {
        super::builder::vertex_rag_data_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(
        &self,
    ) -> super::builder::vertex_rag_data_service::TestIamPermissions {
        super::builder::vertex_rag_data_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::vertex_rag_data_service::ListOperations {
        super::builder::vertex_rag_data_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::vertex_rag_data_service::GetOperation {
        super::builder::vertex_rag_data_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::vertex_rag_data_service::DeleteOperation {
        super::builder::vertex_rag_data_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::vertex_rag_data_service::CancelOperation {
        super::builder::vertex_rag_data_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::vertex_rag_data_service::WaitOperation {
        super::builder::vertex_rag_data_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::VertexRagService;
/// let client = VertexRagService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A service for retrieving relevant contexts.
///
/// # Configuration
///
/// To configure `VertexRagService` use the `with_*` methods in the type returned
/// by [builder()][VertexRagService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::vertex_rag_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::vertex_rag_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `VertexRagService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `VertexRagService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "vertex-rag-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-service")))]
#[derive(Clone, Debug)]
pub struct VertexRagService {
    inner: std::sync::Arc<dyn super::stub::dynamic::VertexRagService>,
}

#[cfg(feature = "vertex-rag-service")]
impl VertexRagService {
    /// Returns a builder for [VertexRagService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::VertexRagService;
    /// let client = VertexRagService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::vertex_rag_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::vertex_rag_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::VertexRagService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::VertexRagService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::VertexRagService> {
        super::transport::VertexRagService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::VertexRagService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::VertexRagService::new)
    }

    /// Retrieves relevant contexts for a query.
    pub fn retrieve_contexts(&self) -> super::builder::vertex_rag_service::RetrieveContexts {
        super::builder::vertex_rag_service::RetrieveContexts::new(self.inner.clone())
    }

    /// Given an input prompt, it returns augmented prompt from vertex rag store
    /// to guide LLM towards generating grounded responses.
    pub fn augment_prompt(&self) -> super::builder::vertex_rag_service::AugmentPrompt {
        super::builder::vertex_rag_service::AugmentPrompt::new(self.inner.clone())
    }

    /// Given an input text, it returns a score that evaluates the factuality of
    /// the text. It also extracts and returns claims from the text and provides
    /// supporting facts.
    pub fn corroborate_content(&self) -> super::builder::vertex_rag_service::CorroborateContent {
        super::builder::vertex_rag_service::CorroborateContent::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::vertex_rag_service::ListLocations {
        super::builder::vertex_rag_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::vertex_rag_service::GetLocation {
        super::builder::vertex_rag_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::vertex_rag_service::SetIamPolicy {
        super::builder::vertex_rag_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::vertex_rag_service::GetIamPolicy {
        super::builder::vertex_rag_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::vertex_rag_service::TestIamPermissions {
        super::builder::vertex_rag_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::vertex_rag_service::ListOperations {
        super::builder::vertex_rag_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::vertex_rag_service::GetOperation {
        super::builder::vertex_rag_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::vertex_rag_service::DeleteOperation {
        super::builder::vertex_rag_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::vertex_rag_service::CancelOperation {
        super::builder::vertex_rag_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::vertex_rag_service::WaitOperation {
        super::builder::vertex_rag_service::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Vertex AI API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_aiplatform_v1::client::VizierService;
/// let client = VizierService::builder().build().await?;
/// // use `client` to make requests to the Vertex AI API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Vertex AI Vizier API.
///
/// Vertex AI Vizier is a service to solve blackbox optimization problems,
/// such as tuning machine learning hyperparameters and searching over deep
/// learning architectures.
///
/// # Configuration
///
/// To configure `VizierService` use the `with_*` methods in the type returned
/// by [builder()][VizierService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://aiplatform.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::vizier_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::vizier_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `VizierService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `VizierService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "vizier-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "vizier-service")))]
#[derive(Clone, Debug)]
pub struct VizierService {
    inner: std::sync::Arc<dyn super::stub::dynamic::VizierService>,
}

#[cfg(feature = "vizier-service")]
impl VizierService {
    /// Returns a builder for [VizierService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_aiplatform_v1::client::VizierService;
    /// let client = VizierService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::vizier_service::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::vizier_service::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::VizierService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::VizierService>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::VizierService> {
        super::transport::VizierService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::VizierService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::VizierService::new)
    }

    /// Creates a Study. A resource name will be generated after creation of the
    /// Study.
    pub fn create_study(&self) -> super::builder::vizier_service::CreateStudy {
        super::builder::vizier_service::CreateStudy::new(self.inner.clone())
    }

    /// Gets a Study by name.
    pub fn get_study(&self) -> super::builder::vizier_service::GetStudy {
        super::builder::vizier_service::GetStudy::new(self.inner.clone())
    }

    /// Lists all the studies in a region for an associated project.
    pub fn list_studies(&self) -> super::builder::vizier_service::ListStudies {
        super::builder::vizier_service::ListStudies::new(self.inner.clone())
    }

    /// Deletes a Study.
    pub fn delete_study(&self) -> super::builder::vizier_service::DeleteStudy {
        super::builder::vizier_service::DeleteStudy::new(self.inner.clone())
    }

    /// Looks a study up using the user-defined display_name field instead of the
    /// fully qualified resource name.
    pub fn lookup_study(&self) -> super::builder::vizier_service::LookupStudy {
        super::builder::vizier_service::LookupStudy::new(self.inner.clone())
    }

    /// Adds one or more Trials to a Study, with parameter values
    /// suggested by Vertex AI Vizier. Returns a long-running
    /// operation associated with the generation of Trial suggestions.
    /// When this long-running operation succeeds, it will contain
    /// a
    /// [SuggestTrialsResponse][google.cloud.aiplatform.v1.SuggestTrialsResponse].
    ///
    /// [google.cloud.aiplatform.v1.SuggestTrialsResponse]: crate::model::SuggestTrialsResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn suggest_trials(&self) -> super::builder::vizier_service::SuggestTrials {
        super::builder::vizier_service::SuggestTrials::new(self.inner.clone())
    }

    /// Adds a user provided Trial to a Study.
    pub fn create_trial(&self) -> super::builder::vizier_service::CreateTrial {
        super::builder::vizier_service::CreateTrial::new(self.inner.clone())
    }

    /// Gets a Trial.
    pub fn get_trial(&self) -> super::builder::vizier_service::GetTrial {
        super::builder::vizier_service::GetTrial::new(self.inner.clone())
    }

    /// Lists the Trials associated with a Study.
    pub fn list_trials(&self) -> super::builder::vizier_service::ListTrials {
        super::builder::vizier_service::ListTrials::new(self.inner.clone())
    }

    /// Adds a measurement of the objective metrics to a Trial. This measurement
    /// is assumed to have been taken before the Trial is complete.
    pub fn add_trial_measurement(&self) -> super::builder::vizier_service::AddTrialMeasurement {
        super::builder::vizier_service::AddTrialMeasurement::new(self.inner.clone())
    }

    /// Marks a Trial as complete.
    pub fn complete_trial(&self) -> super::builder::vizier_service::CompleteTrial {
        super::builder::vizier_service::CompleteTrial::new(self.inner.clone())
    }

    /// Deletes a Trial.
    pub fn delete_trial(&self) -> super::builder::vizier_service::DeleteTrial {
        super::builder::vizier_service::DeleteTrial::new(self.inner.clone())
    }

    /// Checks  whether a Trial should stop or not. Returns a
    /// long-running operation. When the operation is successful,
    /// it will contain a
    /// [CheckTrialEarlyStoppingStateResponse][google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse].
    ///
    /// [google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse]: crate::model::CheckTrialEarlyStoppingStateResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn check_trial_early_stopping_state(
        &self,
    ) -> super::builder::vizier_service::CheckTrialEarlyStoppingState {
        super::builder::vizier_service::CheckTrialEarlyStoppingState::new(self.inner.clone())
    }

    /// Stops a Trial.
    pub fn stop_trial(&self) -> super::builder::vizier_service::StopTrial {
        super::builder::vizier_service::StopTrial::new(self.inner.clone())
    }

    /// Lists the pareto-optimal Trials for multi-objective Study or the
    /// optimal Trials for single-objective Study. The definition of
    /// pareto-optimal can be checked in wiki page.
    /// <https://en.wikipedia.org/wiki/Pareto_efficiency>
    pub fn list_optimal_trials(&self) -> super::builder::vizier_service::ListOptimalTrials {
        super::builder::vizier_service::ListOptimalTrials::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::vizier_service::ListLocations {
        super::builder::vizier_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::vizier_service::GetLocation {
        super::builder::vizier_service::GetLocation::new(self.inner.clone())
    }

    /// Sets the access control policy on the specified resource. Replaces
    /// any existing policy.
    ///
    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
    /// errors.
    pub fn set_iam_policy(&self) -> super::builder::vizier_service::SetIamPolicy {
        super::builder::vizier_service::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource. Returns an empty policy
    /// if the resource exists and does not have a policy set.
    pub fn get_iam_policy(&self) -> super::builder::vizier_service::GetIamPolicy {
        super::builder::vizier_service::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified resource. If the
    /// resource does not exist, this will return an empty set of
    /// permissions, not a `NOT_FOUND` error.
    ///
    /// Note: This operation is designed to be used for building
    /// permission-aware UIs and command-line tools, not for authorization
    /// checking. This operation may "fail open" without warning.
    pub fn test_iam_permissions(&self) -> super::builder::vizier_service::TestIamPermissions {
        super::builder::vizier_service::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::vizier_service::ListOperations {
        super::builder::vizier_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::vizier_service::GetOperation {
        super::builder::vizier_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::vizier_service::DeleteOperation {
        super::builder::vizier_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::vizier_service::CancelOperation {
        super::builder::vizier_service::CancelOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::vizier_service::WaitOperation {
        super::builder::vizier_service::WaitOperation::new(self.inner.clone())
    }
}
